Rifts Posted November 2, 2011 Share Posted November 2, 2011 hey guys! I'm going a little crazy here I have a div 960px wide, I'm trying to horizontally center three divs inside this 960px div. The two outside divs are 350px and the middle one is 10px. I cant seem to get them centered. Here is what I'm doing: html: <div id="main"> <div id="lefthalf"> </div> <div id="middle"> </div> <div id="righthalf"> </div> </div> css: #lefthalf { float:left; background-color: red; width: 350px; height: 400px; border: 1px solid white; } #middle { float:left; background-color: blue; width: 10px; height: 400px; border: 1px solid white; } #righthalf { float:left; background-color: green; width: 350px; height: 400px; border: 1px solid white; } I cant figure out how to center them since they are floated left Link to comment https://forums.phpfreaks.com/topic/250304-centering-3-divs-horizontally-inside-a-div/ Share on other sites More sharing options...
Rifts Posted November 2, 2011 Author Share Posted November 2, 2011 nvm I figured it out by putting those three divs in a div and centering that div. Link to comment https://forums.phpfreaks.com/topic/250304-centering-3-divs-horizontally-inside-a-div/#findComment-1284326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.