Jump to content
  • 0

Проблемы с выравниванием блочного элемента.


iRina
 Share

Question

Не понимаю почему элемент

mlir3 не становится под mlir2, ведь mlir2 становится под mlir1. Неужели только отрицательный маргин в право является решением при данном построении? Не хотелось бы отрицательных маргинов - все таки в спецификации, если не ошибаюсь он не предусматривается. Хочется сделать идеально. Спасибо за внимание.

<!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=utf-8" />
<title>Floats</title>
<style type = "text/css">

*{margin:0; padding:0; border:0}
html,body{height:100%}
body{background:#000000}
ul{list-style:none}

ul{display:inline; width:762px; height:130px; margin:0 0 0 124px; float:left; background:#393939}
ul li{text-align:center}

.mlil1{width:183px; height:39px; margin:3px 0 7px 0; float:left; background:#00ff00}
.mlim1{width:218px; height:72px; margin:10px 0 0 93px; float:left; background:#00ff00}
.mlir1{width:183px; height:39px; margin:3px 0 7px 85px; float:left; background:#00ff00}
.mlir2{width:183px; height:39px; margin:3px 0 7px 0; float:right; background:#00ff00}
.mlil2{width:183px; height:39px; margin:-30px 0 0 0; float:left; background:#0000ff}
.mlir3{width:183px; height:24px; margin:16px 0 7px 0; float:right; background:#eeb52c}
</style>
</head>

<body>
<ul>
<li class = "mlil1">mlil1</li>
<li class = "mlim1">mlim1</li>
<li class = "mlir1">mlir1</li>
<li class = "mlir2">mlir2</li>
<li class = "mlil2">mlil2</li>
<li class = "mlil3">mlil3</li>
<li class = "mlim2">mlim2</li>
<li class = "mlir3">mlir3</li>
</ul>
</body>
</html>

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Не хотелось бы отрицательных маргинов - все таки в спецификации, если не ошибаюсь он не предусматривается

Глупости не читайте

Разрешенно, делайте с отрицательными )))) , отличная техника с использование отрицательных маржинов )).

Link to comment
Share on other sites

  • 0

<!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=utf-8" />
<title>Floats</title>
<style type = "text/css">

*{margin:0; padding:0; border:0}
html,body{height:100%}
body{background:#000000}
ul{list-style:none}

ul{display:inline; width:762px; height:130px; margin:0 0 0 124px; float:left; background:#393939}
ul li{text-align:center}

.mlil1{width:183px; height:39px; margin:3px 0 7px 0; float:left; background:#00ff00}
.mlim1{width:218px; height:72px; margin:10px 0 0 93px; float:left; background:#00ff00}
.mlir1{width:183px; height:39px; margin:3px 0 7px 85px; float:left; background:#00ff00}
.mlil2{width:183px; height:39px; margin:-30px 0 0 0; clear:both; float:left; background:#0000ff}
.mlim2{width:218px; height:72px; margin:10px 0 0 93px; float:left; background:#00ff00}
.mlir2{width:183px; height:39px; margin:-30px 0 7px 0; float:right; background:#00ff00}
.mlil3{width:183px; height:39px; margin:-60px 0 0 0; clear:both; float:left; background:#0000ff}
.mlir3{width:183px; height:24px; margin:-60px 0 7px 0; float:right; background:#eeb52c}
</style>
</head>

<body>
<ul>
<li class = "mlil1">mlil1</li>
<li class = "mlim1">mlim1</li>
<li class = "mlir1">mlir1</li>
<li class = "mlil2">mlil2</li>
<li class = "mlim2">mlim2</li>
<li class = "mlir2">mlir2</li>
<li class = "mlil3">mlil3</li>
<li class = "mlir3">mlir3</li>
</ul>
</body>
</html>

может как-то так?

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