Jump to content
  • 0

Как растянуть блок на оставшуюся высоту экрана?


Razor
 Share

Question

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

Вот, хотяб приблезительно как сделать можно?)

Edited by Razor
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

<div style="width:100%;">второй блок</div>

Вот тебе пример, делал за минуту, так что без критики про доктайпы и отступы и бла-ла-бла:

<html>
<body>
<div style="width:50%; background:#000; height:50%;"></div>
<div style="width:100%; background:#ccc; height:50%;">

</body>
</html>

А или тебе не по ширине, прости ступил, сейчас сделаю.

вот держи, если у кого будут предложения по рациональние с меньшим кол-вом блоков, пишите интересно.

<html>
<body>

<div style="width:50%; background:#ccc; height:100%;">
<div style="width:100%; background:#666; height:300px;">
блок в котором будет ещё чё-нить
</div>
<div>Блок в котором будет всё остальное распологаться</div>
</div>

</body>
</html>

Link to comment
Share on other sites

  • 0

Как вариант:

<!DOCTYPE html>
<style type="text/css">
* { padding: 0; margin: 0; }
html, body, .article { height: 100%; }
.header { height: 100px; background: #ffc; position: absolute; width: 100%; }
.article { background: #cfc; }
.article h1 { padding-top: 100px; }
</style>
<div class="header">Фиксированной высоты шапка</div>
<div class="article">
<h1>Вот... :)</h1>
<p>Основной блок с контентом</p>
</div>

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