Задача такова.
Мне нужно сделать 2 колонки, одна красная, другая зелёная. Задаю цветом. Одна 200 пикселей, другая 600 пикселей. Сделать их надо так, чтобы если в красной колонке больше контента, то обе красная и зелёная полоска тянулись вниз на одинаковое расстояние. А если в зелёной большое, то обе также тянулись вниз на одинаковое расстояние. То есть блоки должны одновременно заканчиваться внизу, а не так, что красный закончится, а зелёный ещё будет тянуться.
Подскажите, как такое реализовать?
Для примера, имеется что-то типа такого:Код:<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div style="width:800px; margin:0 auto;"> <div style="float:left;width:200px; background:#FF0000;"> Много какого-то текста............................. </div> <div style="float:left;width:600px; background:#00ff00;"> Чуток текста </div> </div> </body> </html>
- 19.10.2011 22:07Новичок


- Регистрация: 22.06.2011
- Сообщений: 28
- Репутация: 0
- 19.10.2011 22:11
Как упрощенный вариант сделать в таблице, или попробовать min-height:100% (у колонок)
- 19.10.2011 22:16Новичок


- Регистрация: 22.06.2011
- Сообщений: 28
- Репутация: 0
Упрощенный вариант мне не интересен, нужно это сделать на дивах. Желательно готовый ответ, потому что попробовать то или то не катит, я уже всё перепробовал, у меня не получается.
- 19.10.2011 22:33
Я бы сделал так:
Выкинул background из дивов. Обернул оба дива еще одним, в котором вставил бэкграундом полоску (изображение) repeat-y в один пиксел высотой и справа 800 красных пикселей, слева 600 зеленых. Ну и про clear не забываем. - 19.10.2011 23:03Разработка любых сайтов

- Регистрация: 08.06.2011
- Сообщений: 3,375
- Записей в дневнике: 1
- Репутация: 2506
Rubidian,
index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen, projection" />
<!--[if lte IE 6]><link rel="stylesheet" href="style_ie.css" type="text/css" media="screen, projection" /><![endif]-->
</head>
<body>
<div id="wrapper">
<header id="header">
<strong>Header:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tortor. Praesent dictum, libero ut tempus dictum, neque eros elementum mauris, quis mollis arcu velit ac diam. Etiam neque. Quisque nec turpis. Aliquam arcu nulla, dictum et, lacinia a, mollis in, ante. Sed eu felis in elit tempor venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut ultricies porttitor purus. Proin non tellus at ligula fringilla tristique. Fusce vehicula quam. Curabitur vel tortor vitae pede imperdiet ultrices. Sed tortor.
</header><!-- #header-->
<section id="middle">
<div id="container">
<div id="content">
<strong>Content:</strong> Sed placerat accumsan ligula. Aliquam felis magna, congue quis, tempus eu, aliquam vitae, ante. Cras neque justo, ultrices at, rhoncus a, facilisis eget, nisl. Quisque vitae pede. Nam et augue. Sed a elit. Ut vel massa. Suspendisse nibh pede, ultrices vitae, ultrices nec, mollis non, nibh. In sit amet pede quis leo vulputate hendrerit. Cras laoreet leo et justo auctor condimentum. Integer id enim. Suspendisse egestas, dui ac egestas mollis, libero orci hendrerit lacus, et malesuada lorem neque ac libero. Morbi tempor pulvinar pede. Donec vel elit.
<a href="#" class="expand">Expand column</a> </div><!-- #content-->
</div><!-- #container-->
<aside id="sideLeft">
<strong>Left Sidebar:</strong> Integer velit. Vestibulum nisi nunc, accumsan ut, vehicula sit amet, porta a, mi. Nam nisl tellus, placerat eget, posuere eget, egestas eget, dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In elementum urna a eros. Integer iaculis. Maecenas vel elit.
<a href="#" class="expand">Expand column</a> </aside><!-- #sideLeft -->
<aside id="sideRight">
<strong>Right Sidebar:</strong> Integer velit. Vestibulum nisi nunc, accumsan ut, vehicula sit amet, porta a, mi. Nam nisl tellus, placerat eget, posuere eget, egestas eget, dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In elementum urna a eros. Integer iaculis. Maecenas vel elit.
<a href="#" class="expand">Expand column</a> </aside><!-- #sideRight -->
</section><!-- #middle-->
<footer id="footer">
<strong>Footer:</strong> Mus elit Morbi mus enim lacus at quis Nam eget morbi. Et semper urna urna non at cursus dolor vestibulum neque enim. Tellus interdum at laoreet laoreet lacinia lacinia sed Quisque justo quis. Hendrerit scelerisque lorem elit orci tempor tincidunt enim Phasellus dignissim tincidunt. Nunc vel et Sed nisl Vestibulum odio montes Aliquam volutpat pellentesque. Ut pede sagittis et quis nunc gravida porttitor ligula.
</footer><!-- #footer -->
</div><!-- #wrapper -->
</body>
</html>[свернуть]style.css
* {
margin: 0;
padding: 0;
}
header, nav, section, article, aside, footer {
display: block;
}
body {
font: 12px/18px Arial, Tahoma, Verdana, sans-serif;
}
a {
color: blue;
outline: none;
text-decoration: underline;
}
a:hover {
text-decoration: none;
}
/* Begin of styles for the demonstration (you can remove them) */
a.expand {
width: 150px;
display: block;
margin: 10px 0 0;
}
a.expand:hover {
height: 500px;
}
/* End of of styles for the demonstration */
p {
margin: 0 0 18px
}
img {
border: none;
}
input {
vertical-align: middle;
}
#wrapper {
width: 100%;
min-width: 1000px;
}
/* Header
-----------------------------------------------------------------------------*/
#header {
height: 150px;
background: #FFE680;
}
/* Middle
-----------------------------------------------------------------------------*/
#middle {
border-left: 250px solid #B5E3FF;
border-right: 250px solid #FFACAA;
height: 1%;
position: relative;
}
#middle:after {
content: '.';
display: block;
clear: both;
visibility: hidden;
height: 0;
}
#container {
width: 100%;
float: left;
overflow: hidden;
margin-right: -100%;
}
#content {
padding: 0 20px;
}
/* Sidebar Left
-----------------------------------------------------------------------------*/
#sideLeft {
float: left;
width: 250px;
position: relative;
background: #BFF08E;
left: -250px;
}
/* Sidebar Right
-----------------------------------------------------------------------------*/
#sideRight {
float: right;
margin-right: -250px;
width: 250px;
position: relative;
background: #FFACAA;
}
/* Footer
-----------------------------------------------------------------------------*/
#footer {
height: 100px;
background: #B5E3FF;
}[свернуть]style_ie.css
* html #wrapper,
* html #footer {
width: expression((documentElement.clientWidth||document.body.clientWidth)<1000?'1000px':'');
}[свернуть]Спасибо сказали:
Zvеr(19.10.2011),
Тэги топика:
- html,
- вниз,
- вопрос,
- зелёный,
- колонка,
- красная,
- одинаковый,
- пиксель,
- расстояние,
- сделать
Похожие темы
| Темы | Раздел | Ответов | Последний пост |
|---|---|---|---|
Вопрос по HTML | Web программирование | 11 | 18.10.2011 02:14 |
HTML теги | Web программирование | 14 | 29.04.2011 18:33 |
HTML верстка сайтов. HTML/CSS верстка. | Реклама партнерских программ | 2 | 26.07.2010 13:12 |
Хостинг для html | Хостинг и Серверы | 19 | 07.03.2010 02:20 |
wordpress шаб в html | Прочее | 9 | 21.09.2009 21:34 |
Интересные темы
верстка с помощью div
Табличная верстка уже в прошлом, если хочешь быть настоящим профессионалом читай про div-верстку.



