Jump to content
  • 0

Почему не растягивается div


Aidyn
 Share

Question

Добырй день! Я начинающий, потому не судите строго :)

Не могу понять, почему div, в котором расположен еще div, имеет высотку 0 пикселей? Как его растянуть? Просто я хочу изображение на задний фон сделать, а оно не отражается, как я понял, как раз потому что высота div = 0.

 

8e21f1557a1c.jpg

 

кусок index.tpl

<body>.........	<!-- Шапка (The End)--> 	<!-- Вся страница --> 	<div id="main">		<!-- Основная часть --> 		<div id="content">                       	{include file='slider.tpl'}		        {$content}               	</div>		<!-- Основная часть (The End) -->                                             	</div>	<!-- Вся страница (The End)--> 		<!-- Футер -->	<div id="footer">		<a href="http://simplacms.ru">Скрипт интернет-магазина Simpla</a>	</div>	<!-- Футер (The End)--> 	</body>

кусок CSS

#main {	margin: 0px auto;	width: 1000px;}#content {	float: left;	width: 567px;	margin-bottom: 20px;}

надеюсь я понятно написал :)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Добырй день! Я начинающий, потому не судите строго :)

Не могу понять, почему div, в котором расположен еще div, имеет высотку 0 пикселей? Как его растянуть? Просто я хочу изображение на задний фон сделать, а оно не отражается, как я понял, как раз потому что высота div = 0.

 

8e21f1557a1c.jpg

 

кусок index.tpl

<body>.........	<!-- Шапка (The End)--> 	<!-- Вся страница --> 	<div id="main">		<!-- Основная часть --> 		<div id="content">                       	{include file='slider.tpl'}		        {$content}               	</div>		<!-- Основная часть (The End) -->                                             	</div>	<!-- Вся страница (The End)--> 		<!-- Футер -->	<div id="footer">		<a href="http://simplacms.ru">Скрипт интернет-магазина Simpla</a>	</div>	<!-- Футер (The End)--> 	</body>

кусок CSS

#main {	margin: 0px auto;	width: 1000px;}#content {	float: left;	width: 567px;	margin-bottom: 20px;}

надеюсь я понятно написал :)

 

У #content убери float: left;это значение означает обтикание элемента с правого края и фиксация его с левого.

Если же так сильно хочется оставить там float: left;, то к диву с #main добавь класс clearfix, а в стилях пропиши это:

 

.clearfix:after {

content: " "; /* Older browser do not support empty content */

visibility: hidden;

display: block;

height: 0;

clear: both;

}

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