How do I force asp: label inside asp: table to always have the same width?

I am really NOT CSS SENSITIVE and it doesn't always work as I think.

This is one of the following situations:

I have a simple (2 rows, 2 columns) asp: dynamically generated table. in the right column, it contains a combo box (cell (0, 1))

and a label (cell (1,1))

. When I change the combobox selection, the text in the label changes too. If it's too long for the cell, it resizes the table. I would prefer the text to be in rows to fit the width of the cell.

I don't know if any label property can do this, or should I specify it in the CSS style of the label or cell? i tried to set table width explicitly, cell width in css class, but nothing seems to work and i feel blind in the maze.

0


source to share


4 answers


<label>

the elements can, if you like, be set to display: block;

and then set to a fixed width via CSS. This might be the best solution for you.



+2


source


Unless you've given white space for nowrap, your text should be wrapped in spaces. Is the string unbreakable?



A minimal example url and / or markup might help ...

+1


source


First of all, I must say (as a bitter voice of experience) that if you don't really want to go through CSS and study it to figure it out, this is just the tip of the iceberg in terms of the pain you will experience in web development.

But by the way, a quick and dirty solution would be to change your label as asp: Label to asp: Literal. This will cause it to output directly to your HTML page. Then you have to clearly specify the width of the cell in the table and your text in asp: Literal will most likely be completed (depending on the style you are using of course).

0


source


I found that for the label you need to specifically put style = "white-space: normal" in order to make it work.

0


source







All Articles