system — 2011-07-06T15:56:38-04:00 — #1
margin: 0 0 0 0;
border: 1px solid #1d1d1d;
to this code width not auto and is 100%.
i want-> width: auto;
i not want use position:absolute; or float.
Do you have idea to solve this problem?
ralphm — 2011-07-06T20:39:36-04:00 — #2
If you don't set a width, it defaults to auto. I think maybe you need to show the context of this code, and tell us what you want to see.
[Moved to CSS forum.]
dresden_phoenix — 2011-07-06T22:51:30-04:00 — #3
on a block element, width:auto IS 100% with padding included. in order for it to "shrinkwrap" you need to use float, position:absolute OR display:inline ( or inline-block).
rayzur — 2011-07-06T23:05:40-04:00 — #4
Then I would lean towards display:inline-block; since you are setting a height on it.
As dresden_phoenix mentioned, it is a shrinkwrapping element that will expand to the width of it's content. It is also capable of taking dimensions like a block level element.
system — 2011-07-07T00:14:40-04:00 — #5
Thank you, i use of this and worked.
paulob — 2011-07-07T09:21:32-04:00 — #6
Note that inline-table won't work for IE7 and under though so inline-block may have been a better choice as there is a hack to make it work in IE7 and under also - if you are interested