![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi! I am looking for a cleaner solution that would display sth. like this, but I simply ran out of ideas: ----- table border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #d4d4d4;" tr td style="padding: 1px; background-color: #ffffff;" input type="submit" value="test 123" style="height: 18px; background: #e9eaea url(gradient.gif) left top repeat-x; width: auto; border: none; padding: 0px 10px;" / /td /tr /table ----- (I have attached an image - a button of height 18px and auto width that has a white border of 1px and around it a dark-gray border of 1px. The background of the button must be a gradient image) I have tried this: ----- div class="button" input type="submit" class="button" value="test 123" / /div ----- CSS: ----- div.button { display: inline; border: 1px solid #d4d4d4; background-color: #ffffff; padding: 1px; } input.button { background: #e9eaea url(gradient.gif) left top repeat-x; padding: 0px; margin: 0px 10px; border: none; height: 18px; line-height: 18px; } ----- If div.button is display:block; then I can't set width to auto. On the other hand if it is inline I can't specify height. Of course, I am looking for cross-browser no-hacks solution. Otherwise I'd rather resort to tables. ![]() Is this possible? I would appreciate some help. Thanks, Anze |
#2
| |||
| |||
|
Hmmm... anyone? ![]() |
#3
| |||
| |||
|
Hmmm... anyone? ![]() No. When you posted an attachment to Usenet, you excluded constructive discussion - especially since you failed to provide a URL. Well, an absolute URL, that is. |

#4
| |||
| |||
|
Hmmm... anyone? ![]() No. When you posted an attachment to Usenet, you excluded constructive discussion - especially since you failed to provide a URL. Well, an absolute URL, that is. Sorry, I thought the mail was clear enough and the image was just an added bonus. |
|
Here is the URL: http://users.volja.net/anzesk/usenet/test.html I would still appreciate any thoughts on this. I can find many workarounds but not... The Right Way (tm). ![]() |
#5
| |||
| |||
|
|
Sorry, I thought the mail was clear enough and the image was just an added bonus. Not on usenet non-binary groups. |

|
I think it may be a case of not trying so hard to control the layout when you stop using tables, and accept the compromise. Also check how other major browsers are rendering the markup. |

#6
| |||
| |||
|
|
It just seems so limiting that there is no some way to tell a div to shrink as much as it can. |
#7
| |||
| |||
|
|
It just seems so limiting that there is no some way to tell a div to shrink as much as it can. Floating a div does this. |
Thank you!
#8
| |||
| |||
|
|
Also, IE doesn't allow to eliminate space left and right from text - setting padding to 0 still shows some space left. |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
For completeness: http://css.maxdesign.com.au/floatutorial/introduction.htm Quote: ----- Do floated items need a width? You should always set a width on floated items (except if applied directly to an image - which has implicit width). W3C's Cascading Style Sheets, level 2, CSS2 Specifications states: "A floated box must have an explicit width..." http://www.w3.org/TR/CSS2/visuren.html#floats If no width is set, the results can be unpredictable. Theoretically, a floated element with an undefined width should shrink to the widest element within it. This could be a word, a sentence or even a single character - and results can vary from browser to browser. ----- It looks like all major browsers shrink float elements to the widest element within, but there is no guarantee. W3C certainly doesn't specify it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |