Jump to content
  • 0

Три "float" и "clear:both;"


tga123
 Share

Question

У меня получается это:

87f4a2286265t.jpg

А надо это:

2444b34af3f7t.jpg

Вот код:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
#left {
height:150px;
width:100px;
float:left;
background:#990000;
}
#inner_left {
height:80px;
width:70px;
float:left;
background:#3366FF;
margin-right:10px;
}
#right {
width:100px;
height:250px;
float:right;
background:#990000;
}
#center {
margin-left:110px;
background:#339966;
margin-right:110px;
padding:10px;
margin-bottom:10px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
</style>
</head>
<body>
<div id="left">left</div>
<div id="right">right</div>
<div id="center">
<div id="inner_left">inner_left</div>
<div>1<br />2<br />3</div>
<div class="clearfloat"></div>
</div>
<div id="center">
<div id="inner_left">inner_left</div>
<div>1<br />2<br />3</div>
<div class="clearfloat"></div>
</div>
</body>
</html>

Что я делаю не так?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Реализуйте самый обычный трехколоночный макет («css трехколоночный макет» в Google.), а потом вставляйте в центральную колонку ваши зеленые блоки. И не нужны вам никакие clear: both;.

Link to comment
Share on other sites

  • 0
Реализуйте самый обычный трехколоночный макет («css трехколоночный макет» в Google.), а потом вставляйте в центральную колонку ваши зеленые блоки. И не нужны вам никакие clear: both;.

Мне нужно чтобы центральные блоки был "резиновым", и в них можно было использовать "clear:both;", для того что небыло вот так:

24c4e1a115cct.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy