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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div Alignment and FireFox 2

Status
Not open for further replies.

BoulderBum

Programmer
Jul 11, 2002
2,179
0
0
US
I have a div:

Code:
<div style="text-align: right; width: 400px;">
   blah
</div>

This works for alignment on IE, but not FireFox.

Can anyone tell me the proper way to do this with style/CSS?
 
Since you say "div alignment" in your title, I gather you want to align the div to the right. Not just text within the div, which is what you're doing right now. So you should try:
Code:
<div style="[b][blue]margin-right: 0; margin-left: auto;[/blue][/b] width: 400px;">
   blah
</div>
 
Also style="float: right" will work with a slightly different behaviour. depends what you want to use it for.
 
Thanks guys. Both worked.

Out of curiosity, how would I do the same thing with vertical alignment to get something aligned on the bottom of a div?

I tried margin-bottom: 0; margin-top: auto; but that didn't seem to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top