Forum Moderators: not2easy

Message Too Old, No Replies

cant centre inside div

im trying to centre a coded feature box and it wont do it

         

portugal paul

10:19 pm on Feb 2, 2009 (gmt 0)

10+ Year Member



Hi I am having trouble centering a real estate featured listing box i have nested one div inside another to seperate it from the text but it aligns left i can set it in any position by using
margin-left: 1in; eg, but i cannot center it the main column (centre) is liquid and has two fixed width colmns either side can anyone shed some light please.
<head>

.midhead {
margin-left: 0 auto;
margin-left: 0 auto;
position: relative ;
padding: 10px;
}

.centrecolumn {
padding-left:50px;
padding-top: 40px;
font-family: georgia;
font-size: 12px;
color: #C0C0C0;
text-decoration: none;
text-align: justify;
border: hidden;
margin-left: 3in;
margin-right: 3in;
position:relative top;

}
</head>
<body>
<div class="centrecolumn">

<div class="midhead">{featuredListings}</div>

</div>
</div>
</body

simonuk

8:45 am on Feb 3, 2009 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld!

Your code is invalid which won't help. The margins in .minhead should only contain one value. You can have either:

margin: 0 auto;
or
margin-left:0

Also the postion element in .centrecolumn should not contain the "top".

Now onto your problem. If you just want the text to centre than add:
text-align:center; to midhead

If you want the whole midhead to centre then add a width to it and set a margin like this:

margin: 0 auto;

That will then centre the box.

portugal paul

11:06 am on Feb 3, 2009 (gmt 0)

10+ Year Member



Thankyou very much I am rather new at css that sorted it it was the whole midhead i wanted centering