Jump to content
  • 0

Размещение блоков css


geroi
 Share

Question

Не Могу разместить блоки чтобе они располагались вот так:

6LEDfViWQb.png

<style>
* {
vertical-align: top;
margin: 0;
padding: 0;
zoom: 1;
}

</style>

<div style="width:192px;background:#000;">
<div style="display:inline-block;background:red;width:32px;height:32px"></div>
<div style="display:inline-block;background:green;width:32px;height:32px">
</div>
<div style="display:inline-block;background:blue;width:64px;height:64px">
</div>
<div style="display:inline-block;background:orange;width:32px;height:32px">
</div>
<div style="display:inline-block;background:orange;width:32px;height:32px">
</div>
<div style="display:inline-block;background:orange;width:32px;height:32px">
</div>
</div>

А у меня получается только вот так:

lC8kyaEtBX.png

Буду очень благодарен за помощь! B)

Edited by geroi
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Первые четыре блока (которые квадрат составляют) оберните в ещё один блок. Итого будет три блока: эта обёртка, синий блок и крайний правый маленький. Внутри обёртки четыре блока уже как-то раскидывайте. Таблицей проще всего, не хотите таблицей - поковыряйтесь с float.

Link to comment
Share on other sites

  • 0

Спасибо твоя подсказка мне очень помогла, решил задачу таким вот способом:


<style>
#style1 div {
display:inline-block;
white-space:nowrap;
float:left;
}
#style1 div.style3 {
width:32px;
height:32px;
visibility:hidden;
}
#style1 div.style2 {
height:32px;
display:block;
position:static;
}
</style>

<div id="style1">

<div class="style2">
<div class="style3"></div>
<div class="style3"></div>
<div style="width:64px;height:64px;"></div>
<div class="style3""></div>
<div class="style3"></div>
</div>
<div class="style2">
<div class="style3"></div>
<div class="style3"></div>
<div class="style3"></div>
<div class="style3"></div>
</div>

</div>

Edited by geroi
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