Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please do NOT inherit

Status
Not open for further replies.

Luzian

Programmer
Nov 27, 2005
103
0
0
US
I've a fieldset that I do NOT want spanning across the freaking page, or any fieldset, so:
Code:
fieldset
{
[tab]display: inline;
}
Now my table within the fieldset looks like crap because it's also inline. How about it doesn't do that. So how?
 
First of all, displays are not inherited, since if they were, all our elemenets would always be block level due to the initial body being block level.

On the other note however, don't try to putting block level elements into inline ones. It would be similar if you wanted to park your car into a sheet of paper. Even if it is a big sheet, it won't fit. So things could always be failing with this kind of technique.

What exactly are you trying to do? If all you want is not to have fieldset defaulted to 100% width, you can just specify that. [tt]width: auto;[/tt] will make it just as wide as the content inside, similar to the default behaviour of tables, which also have width: auto; as their default width.
 
thanks for the response.
What exactly are you trying to do? If all you want is not to have fieldset defaulted to 100% width, you can just specify that. width: auto; will make it just as wide as the content inside, similar to the default behaviour of tables, which also have width: auto; as their default width.
I now tried this, but it doesn't work as you say it does.
Code:
fieldset{width: auto;}
As you said, I want the width of the fieldset to be as big as the content inside it, but it's still at 100% after the modification.
 
Ok, I guess I shouldn't assume that all elements will adhere to the rules... I wouldn't normally suggest this, but you can probably get away with it if you are just cautious enough with the clears. Floating an element will automagically make its width auto -- even when actual auto width does not apply. So try floating your fieldset:
Code:
fieldset { float: left; }
Don't forget to clear the next element though.
 
I think "float: left" also demoted the fieldset from block to inline. The fieldset's width is how I want it, but now the table inside has misaligned columns the same way when I had:
Code:
fieldset
{
    display: inline;
}
 
Actually, that is completely impossible since by default floating an element makes it block regardless of what the display setting of the element is. Even moreso, display is ignored when element is floated, since it is only possible for the element to be of block level.

Could you please show us the code or even better a link to this problem? It would be easier to debug if we could see exactly how your table is affected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top