收录日期:2019/12/16 13:23:05 时间:2010-10-28 14:17:33 标签:css

URL:http://edgarferro.squarespace.com/secondtry

The green div (.button1) is overlappig the other div (.message, .principle), I want to know how to separte both of them.

Thanks

%%%%%%%%%%% Here is the code that I am running in HTML editor %%%%%%%%%%%%%%

<div class="column">
<a href=""><div class="principle">
<h2> BIZ</h2>
</div></a>
<div class="principle">
<h2>< Refresh</h2>
</div>
<div class="principle">
<h2> Net</h2>
</div>
</div>

<div class="column">
<div class="principle">
<h2>Process</h2>
</div>
<div class="principle">
<h2> Graphs</h2>
</div>
<div class="principle">
<h2> Content</h2>
</div>
</div>

<div class="column">
<div class="principle">
<h2> Chat</h2>
</div>
<div class="principle">
<h2>DVD</h2>
</div>
<div class="principle">
<h2> DB</h2>
</div>
</div>


</div>
</div>

<a href="">
<div class="button1">
 World Wide Web
</div></a>

@@@@@@@@@@@@@@@@@@ Here is the CSS @@@@@@@@@@@@@@@@@@

.message .message_mani {
float:left;
width:690px;
}
.message .message_mani div.column {
float:left;
margin:0 22px 22px 0;
width:200px;
}
.message .message_mani div.column div.principle {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
-moz-border-radius-bottomleft:5px;
-moz-border-radius-bottomright:5px;
-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;
background:#333333 none repeat scroll 0 0;
display:block;
float:left;
margin:0 10px 22px 12px;
opacity:1;
width:210px;
}
.message .message_mani div.column div.principle  h2 {
-x-system-font:none;
color:#FFFFFF;
font-family:georgia,arial,sans-serif;
font-size:24px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:30px;
padding:10px 15px;
text-align:center;
}
.message .message_mani h1 {
-x-system-font:none;
color:#FFFFFF;
font-family:georgia,arial,sans-serif;
font-size:36px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:42px;
padding:0 25px 10px 10px;
text-shadow:1px 1px 1px #444444;
}
.message .message_mani h2 {
-x-system-font:none;
color:#0DA5BD;
font-family:georgia,arial,sans-serif;
font-size:24px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:32px;
margin:10px 0;
padding:0 25px 10px 10px;
text-shadow:1px 1px 1px #444444;
}
.message .message_mani div.column div.principle:hover {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#0DA5BD none repeat scroll 0 0;
opacity:1;
}
.message .message_mani div.column div.principle h2 {
-x-system-font:none;
font-family:georgia,arial,sans-serif;
font-size:24px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:30px;
padding:20px;
text-shadow:1px 1px 1px #444444;
}


/**color buttons **/

.button1, .button2, .button3, .button4, .button5 {
-moz-border-radius-bottomleft:5px;
-moz-border-radius-bottomright:5px;
-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;
border:1px solid;
font-family:Tahoma,Geneva,sans-serif;
font-size:24px;
margin-bottom:15px;
padding:10px 5px 10px 10px;
width:auto;
}
.button1 div, .button2 div, .button3 div, .button4 div {
font-size:14px;
padding-left:30px;
width:auto;
}
.button1, .button1 a {
background-color:#999966;
color:#FFFFFF;
text-align:center;
width:auto;
}

You need to clear your floats. The easiest way to clear floats is to add overflow:hidden to the parent element that contains the floats. So add overflow:hidden to .message class.

The css float property is used alot in web layouts. Here is a great tutorial that will help you understand everything about it http://css.maxdesign.com.au/floatutorial/

And here is a good post about clearing floats http://www.quirksmode.org/css/clearing.html

Good Luck!