/    Sign up×
Community /Pin to ProfileBookmark

CSS Not Aligning Correctly

Hello there. I have a problem with my css. I want to make an online store have the products in three columns, but when I make three columns with css, the product boxes are not lining up correctly. I have posted the CSS and the HTML below.

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<title>Barkleigh Online Store</title>
<link href=”store_styles2.css” rel=”stylesheet” type=”text/css” />
</head>

<body>
<div id=”main_area”>
<div class=”nav_bar_top”>
<img src=”http://www.barkleigh.com/store_barkp.gif” />
<img src=”http://www.barkleigh.com/shop_3.gif” />
<img src=”http://www.barkleigh.com/main_2.gif” />
<img src=”http://www.barkleigh.com/homepage1.gif” />

</div>

<div class=”product_column1″>
<img src=”http://www.barkleigh.com/store_GKFront.jpg” width=”200px” />
</div>

<div class=”product_column3″>
<img src=”http://www.barkleigh.com/store_GroomOgram.jpg” width=”200px” />
</div>

<div class=”product_column2″>
<img src=”http://www.barkleigh.com/store_GKFront.jpg” width=”200px” />
</div>

<div class=”product_column1″>
<img src=”https://www.barkleigh.com/Store_Reminder_r1.jpg” width=”200px” />
</div>

<div class=”product_column3″>
<img src=”https://www.barkleigh.com/store_kenn_L_front.jpg” width=”200px” />
</div>

<div class=”product_column2″>
<img src=”https://www.barkleigh.com/store_groom_sales_slip.jpg” width=”200px” />
</div>

</div>

</body>
</html>
[/CODE]

[CODE]/* CSS Document */

#main_area
{
background-color:#CC9900;
height:800px;
width:750px;
margin-left:auto;
margin-right:auto;
border:solid;
padding:5px;
}

body{
background-color:#996633;
}

.nav_bar_top{
width:650px;
text-align:center;
border:solid;
margin-left:auto;
margin-right:auto;
background-color:#000000;
padding:5px;
}

.product_column1{
width:210px;
height:200px;
background-color:#993300;
text-align:center;
border:solid;
margin-top:8px;
padding:5px;
float:left;
}

.product_column2{
width:210px;
height:200px;
background-color:#993300;
text-align:center;
border:solid;
margin-top:8px;
margin-left:5px;
padding:5px;
}

.product_column3{
width:210px;
height:200px;
background-color:#993300;
text-align:center;
border:solid;
margin-top:8px;
margin-right:5px;
padding:5px;
float:right;
}[/CODE]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@Wiz_CreationsNov 24.2006 — Since the middle column is just falling under the left column, you could try changing the margin-left: to 260px. That number should put it somewhere near the center. If you do it that way, you should mathematically calculate what the margin needs to be.
Copy linkTweet thisAlerts:
@bp_travisauthorNov 24.2006 — Hello. That worked until I told the boxes to do auto height. Now instead of a set height of 200px, I set them to auto and it messed up the page again, but only slightly. Any suggestions? Thanks.
×

Success!

Help @bp_travis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...