PDA

View Full Version : Can't get div elements to align properly



birdwing
December 7th, 2008, 11:23 AM
I'm having some trouble placing elements on the page... I'm not sure if its just a FF/safari issue or if I'm just doing something wrong.

The project images wont line up where there supposed to (under current projects heading)

They line up under the entire container div

This is how the div's are nested:


<div id="content">
<div id="updates">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pharetra pellentesque nisl. Nam euismod tempus odio. Fusce imperdiet hendrerit ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam egestas feugiat diam. Duis ut neque. Maecenas neque odio, dapibus et, interdum ut, laoreet a, augue. Proin non ligula quis sem sagittis auctor. Suspendisse hendrerit posuere nunc. Sed iaculis fermentum lacus. Sed eu metus et eros fringilla posuere. Suspendisse vel pede. </div>
</div>
<div id="projects">
<img src="images/proj1.gif" alt="Project 1">
<img src="images/proj2.gif" alt="Project 2">
<img src="images/proj3.gif" alt="Project 3">
</div>
</div>


And this is the CSS I am using to try and place the elements:



#main #content {
background-image: url(images/content_bg.gif);
background-repeat: no-repeat;
background-color: #C0D0BA;
background-position: center top;
width: 1010px;
height: 346px;
float: left;
}
#main #content #updates {
background-color: bedbbb;
border-color: #303030;
border: 1px;
position: relative;
float: left;
left: 14px;
top: 10px;
width: 300px;
font-family: "Times New Roman", Times, serif;
font-size: 12pt;
padding: 10px;
}
#main #content #projects {
position: relative;
float: left;
right: 14px;
top: 10px;
}


As you can tell from the link: http://www.birdwingfx.com/testweb/main.html

The updates Div is aligning properly, but not the projects.


I've tried clear left right and all on both the projects and updates divs. I cant seem to find this bug. Of course I don't have IE on my mac so I can't tell if its an issue with my browser or not.

myoreo
December 7th, 2008, 04:20 PM
in your html page you have an extra </div> tag before <div id="projects"> That closes the content div.

You also should have float:right for projects div instead of left.

birdwing
December 7th, 2008, 09:51 PM
(feels like an idiot)

I didn't even notice that O.O dreamweaver put it way over to the right so I didn't see it.

wow. Thank you.

knicksfan77
December 8th, 2008, 11:52 AM
CSS is always a pain in the butt. Do you know if Dreamweaver is going to offer software to code pure CSS at any point? The software has become useless without tables for the msot part

birdwing
December 8th, 2008, 01:36 PM
No idea..


I would hope so. Adob tends to be in on the major trends so they should have something soon.


I ran into another issue with the page however, you can see my post here:
http://www.kirupa.com/forum/showthread.php?t=315139