Jump to content
  • 0

проблема с float


BondJ
 Share

Question

промлема в том, что когда я прописываю картинке float, она становится как бы не видимой для блоков которые следуют после неё... помогите кто чем может))

вот код:

<div id="content">
<h1>Home</h1>
<img class="line" src="img/line.png" alt="дет сайт" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse sagittis. Donec dictum, magna
ullamcorper eleifend dapibus, lectus purus condimentum tellus, eu blandit nisl augue et massa.
Mauris nisl diam, placerat vel, lacinia eu, luctus at, orci.Cras eget libero at sapien molestie
condimentum. Ut interdum elit in risus. Pellentesque nisi. Aenean mauris nisl, interdum eu,tempor
fermentum, dictum nec, nulla. Fusce bibendum eros ut felis. Nunc viverra quam sit amet augue.
Sed feugiat quam id elit. Ut id nulla at ligula accumsan pharetra. Maecenas sit amet mi. In vel velit.
condimentum. Ut interdum elit in risus. Pellentesque nisi. Aenean mauris nisl, interdum eu,tempor
fermentum, dictum nec, nulla. Fusce bibendum eros ut felis. Nunc viverra quam sit amet augue.
Sed feugiat quam id elit. Ut id nulla at ligula accumsan pharetra. Maecenas sit amet mi. In vel velit</p>
<img class="img" src="img/img.jpg" />
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing
elit. Suspendisse sagittis. Donec dictum, magna
ullamcorper eleifend dapibus, lectus purus
condimentum tellus, eu blandit nisl augue et massa.
Mauris nisl diam, placerat vel, lacinia eu, luctus at,
orci.Cras eget libero at sapien molestie condimentum.
Ut interdum elit in risus. Pellentesque nisi. Aenean
mauris nisl, interdum eu,tempor fermentum, dictum
nec, nulla. Fusce bibendum eros ut felis. Nunc viverra
quam sit amet augue. Sed feugiat quam id elit. Ut id
nulla at ligula accumsan pharetra. Maecenas sit amet
mi. In vel velit.</p>

<div id="footer">

</div><!-- #footer -->
</div><!-- #content-->

Css:

#content {
width:870px;
margin-left:40px;
background-color:#FFFFFF;
}
#content h1 {
color:#5b8f4e;
font:"Times New Roman", Times, serif;
font-size:26px;
margin-left:20px;
padding-top: 20px;
}
.line {
margin-left:20px;
}
#content p {
font-family:"Times New Roman", Times, serif;
font-size:20px;
color:#ff9933;
padding-left:20px;
padding-right:15px;
}
.img {
border:2px solid #e79616;
margin-left:33px;
overflow: hidden;
margin-right:10px;
width:365px;
height:275px;
}

/* Footer
—————————————————————————--*/
#footer {
height: 60px;
margin-top:80px;
background-image:url(img/bg-footer.png);
background-repeat:no-repeat;
width:846px;
height:49px;
margin-left:12px;
padding-bottom:5px;
}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

overflow: hidden родителю?

блок футер проходит сквозь картинку, будто е нет(

#content {
width:870px;
margin-left:40px;
background-color:#FFFFFF;
overflow:hidden;
}
#content h1 {
color:#5b8f4e;
font:"Times New Roman", Times, serif;
font-size:26px;
margin-left:20px;
padding-top: 20px;
}
.line {
margin-left:20px;
}
#content p {
font-family:"Times New Roman", Times, serif;
font-size:20px;
color:#ff9933;
padding-left:20px;
padding-right:15px;
}
.img {
border:2px solid #e79616;
margin-left:33px;
float:left;
margin-right:10px;
width:365px;
height:275px;
}

/* Footer
—————————————————————————--*/
#footer {
height: 60px;
margin-top:80px;
background-image:url(img/bg-footer.png);
background-repeat:no-repeat;
width:846px;
height:49px;
margin-left:12px;
padding-bottom:5px;
}

Link to comment
Share on other sites

  • 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