Jump to content
  • 0

Проблема с резиновой версткой


fest
 Share

Question

Подскажите, пожалуйста.

Есть два блока, соответственно float:right;(left)

Они разного размера, условно, первый 200px второй 400px

Между ними нужно сделать разделитель, который всегда будет посередине (относительно блоков).

cd5a461c69b0b76753b3f624c8deccf3.png

Мой вариант верстки, проблема в том, что разделитель перекрывает первый и второй блок.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<div class="middle" style="height: 366px;">
<div class="sidebar" id="sideLeft">
<h2>Text1</h2>
</div><!-- .sidebar#sideLeft -->

<div class="sidebar" id="sideRight">
<h2>Text2</h2>
</div><!-- .sidebar#sideRight -->

</div>

/* Middle
—————————————————————————--*/
.middle {
background: url(images/sep.png) repeat-y scroll 44% top transparent;
position: relative;
top: 25px;
}

/* Sidebar Left
—————————————————————————--*/
#sideLeft {
float: left;
width: 260px;
position: relative;
height: 300px;
padding: 20px;
margin: 10px 0 0 50px;


}


/* Sidebar Right
—————————————————————————--*/
#sideRight {
float: right;
width: 360px;
position: relative;
background: #FFACAA;
height: 300px;
padding: 20px;
margin: 10px 50px 0 0;
}

Буду благодарен за помощь.

Edited by fest
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Если вы хотите, чтобы разделитель зависел от расположения и размеров блоков, то и ставьте его в один поток с ними. Вариантов много, например, сделайте разделитель в плавающем блоке и пусть он следует за левым блоком. И правый блок не надо float:right, тоже пусть идет следом (float:left). Его можно сделать вообще и не плавающим, а просто отрегулировать положение левым марджином...

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