简体   繁体   中英

Why my divs dont want to be in one line?

Im bothering with simple problem, just dont know why my divs dont want to be displayed in one line. Every thing should be fine, i use float: left.

This is how its looks like:

在此输入图像描述

html:

  <div id="centrumwspolpraca">
    <div id="w1">Wspólne projekty przechodzą cały proces,<br>zaczynając od briefu po realizację i strategię marketingową.<div>
    <div id="w2"><img src="images/wspolpraca.png"><div>
    <div id="w3"><b class="regular">MYŚLIMY GLOBALNIE<div>
  </div>

CSS:

#centrumwspolpraca{
width:1200px;
height: 500px;
margin: 0 auto;
position: relative;
background: green;
}

#w1{
float:left;
width: 300px;
height: 500px;
overflow: hidden;
font-size: 12px;
position: relative;
background: red;
}
#w2{
float:left;
width: 800px;
height: 500px;
overflow: hidden;
position: relative;
background: yellow;
}

#w3{
float:left;
width: 100px;
height: 500px;
overflow: hidden;
font-size: 12px;
position: relative;
background: blue;
}

You are not closing in the right way your <div> tags, you have:

<div id="w2"><img src="images/wspolpraca.png"><div>

It must be : Add the / to close the tag

<div id="w2"><img src="images/wspolpraca.png"></div>

The demo http://jsfiddle.net/rc56k/2/

You have an error in your HTML

<div id="centrumwspolpraca">
    <div id="w1">Wspólne projekty przechodzą cały proces,<br>zaczynając od briefu po realizację i strategię marketingową.</div>
    <div id="w2"><img src="images/wspolpraca.png"></div>
    <div id="w3"><b class="regular">MYŚLIMY GLOBALNIE</div>
</div>

close inner DIV's

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM