As you probably know, it is against recommended practice to use tables to layout a page in HTML, and instead use CSS.
There's just one thing I can't figure out how to do with CSS, and that's this:
| Name: | |
| Password: |
What I mean is the fact that I want to left-align the two textboxes on eachother. This means that conceptually, I have two inline-block level elements, both containing two block level elements.
Now there is a CSS2.1 way to partically solve it, and that's this:
<div style="display:inline-block;vertical-align:top">
<div>Name:</div>
<div>Password:</div>
</div>
<div style="display:inline-block">
<div><input type="text" /></div>
<div><input type="text" /></div>
</div>
And in fact, I can do that, the result is this:
(EDIT: As you can see, this doesn't work. It works in the RichTextBox though, so you can see what I mean by replying with quote.)
As you can see, nice vertical alignment, but not-so-nice horizontal aligment. If you look at the source you'll also see a slight difference between the HTML sample I give above and the HTML I actually used to produce that result: I used <span> instead of <div> for the outer elements. This is necessary because IE only supports display:inline-block on <span>. This however has the side effect of it not being valid HTML anymore. What's more, Firefox doesn't support inline-block at all (it support -moz-inline-box, but that's buggy at best).
So is there any way to solve this problem, or is there no recourse except tables in this situation? Preferably one that also works in today's browsers.
Note: if there's a standards-compliant solution that doesn't work in IE/Firefox/insert-browser-here, I'd still like to know it.
(and on a related note, I'd love to use inline-block in situations where horizontal alignment doesn't matter, but I can't because Opera 7 is the only browser that to my knowledge supports it correctly)
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.