Jump to content
  • 0

Div в div'e


chertixa
 Share

Question

Здравствуйте!

Есть div, в котором содержится еще 6 div'ов - 6 кнопок. Каждая кнопка немного наложена на другую, поэтому место, занимаемое кнопками, меньше размера исходного div'a.

Т.е. кнопка длиной 135, 135х6=810. С учетом наложения - 735. Если делать исходный div размера 735, то последняя кнопка переносится на след. строку. Я думаю из-за того, что кнопки были смещены относительно исходного положения. Как это убрать?


<div id="menu">
<div id="block1"><img src="but1.gif"></img>
</div>
<div id="block2"><img src="but2.gif"></img>
</div>
<div id="block3"><img src="but3.gif"></img>
</div>
<div id="block4">img src="but4.gif"></img>
</div>
<div id="block5">img src="but5.gif"></img>
</div>
<div id="block6">img src="but6.gif"></img>
</div>
</div>

#menu
{
position: absolute;
width: 810px;
height: 50px;
left: 50%;
margin-left: -265px;
display: inline;
border: 2px double red;
}
#block1,#block2,#block3,#block4,#block5
{
position: relative;
float: left;
padding: 0px;
margin: 0px;
}

#block1
{
z-index: 2;
display: inline;
}

#block2
{
left: -15px;
z-index: 3;
display: inline;
}
#block3
{
z-index: 3;
left: -30px;
display: inline;
}
#block4
{
left: -45px;
z-index: 3;
display: inline;
}
#block5
{
left: -60px;
z-index: 3;
display: inline;
}
#block6
{
position: relative;
padding: 0px;
margin: 0px;
left: -75px;
z-index: 3;
display: inline;
}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

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