View Full Version : Divs


MistressVivi
12-02-2003, 08:50 PM
Is there a way to align divs on a page? For example, you have a div in a table, but you want the div to be up against the right side instead of the left, sorta like algning text. Is there any way to do this?

kittycat
12-02-2003, 09:40 PM
If it's in a table cell, you should be able to put align=right into the td tag and the div will go to the right. If you want the text inside the div to align to the right as well, add it to the div tag.

hockyfan641
12-02-2003, 10:05 PM
You can also use absolute positioning also, correct? But if you did that it wouldn't really be inside the table.

MistressVivi
12-02-2003, 10:15 PM
well, the problem with aligning the div through the TD is that it would align the text as well. I shoulda specified earlier - in the cell there's both text and the divs. As for absolute positioning...no clue how to use it ^^; and I'd also like the divs to stay relative to the text...or some such thing, heh. Not so the divs can float over the text, I mean.

Alcy
12-05-2003, 02:18 AM
The "float" property perhaps (at least I think it's a property ^^;;):

<div style="float: right;">
whatever
</div>

hockyfan641
12-05-2003, 02:27 AM
I'm pretty sure float: screws up IE.

fruitcake
12-05-2003, 03:33 AM
Make a second div to contain the div you want to line up on the right:

.main {
width: 100%;
text-align: right;
}

.right {
... whatever styles...
}


<div class="main">
<div class="right">
text
</div>
</div>


Something like that, and it should work for you :)

MistressVivi
12-06-2003, 04:25 PM
ah, that method worked! Thanks much!

pb&j
12-06-2003, 09:23 PM
Originally posted by hockyfan641
I'm pretty sure float: screws up IE.
float works fine in IE6.

hockyfan641
12-06-2003, 10:25 PM
Originally posted by pb&j
float works fine in IE6.
hmm...It must be older versions of IE. I'll see if I can find out where I read that.

hockyfan641
12-07-2003, 05:04 PM
I found what w3schools says about float:


Note in Internet Explorer 4.0:

* This property does not work with inline elements, lists, list items, tables, or table cells

Note in Internet Explorer 5.0:

* This property works with inline elements, lists, and list items

Note in Netscape 4.x:

* This property does not work properly with inline elements, select, textarea, lists, list items, tables, or table cells