fixing span width
I have this table1 inside of a span tag (span is inside of td tag)
the problem is that the row data of the Table1 is appearing outside of td
...the data should appear within the boundaries of td
tag..right ? coz the span is contained within the td tag开发者_JS百科...how do I make sure that the width of span remains fixed..like it shouldn't display stuff outside of td
tag which is its container
Firebug shows table1's width as 100%
[Edit]
ok I added display:block;
in span tag first..didnt work...when I added the same in Table tag the columns of the Table shrank..ie spaces between col.s shrank and row data isn't anymore displaying outside of td's area
Now what I wanna ask is that if I set Table{display:block;}
in the css file..how would it affect other tables ??I don't want other tables to get screwed up...Just want this one fixed..Also, the table is being created on runtime using Telerik's RadEditor so will display:block fix table's width and not let its rows' data flow outside td area??
<span>
s are inline elements, like <a>
and <img>
, therefore they cannot accept rules like width:, height: and others.
To allow the <span>
to accept these rules, add display: block;
to the Span's CSS.
This will allow it to accept the width rule and fill up your TD.
That or just change your <span>
to a <div>
.
If that doesn't work, post your code and we'll take a closer look :)
A span is an inline element and so cannot have an explicit width set. What is in the span? If it's a continuous string then there is no way for the browser to know where to cut the string and make it wrap. If you don't want to see the excess content then you can set overflow:hidden on the element but that's not always a good idea. Perhaps post the code you are working with and we can provide more specific help.
精彩评论