zan
zan

Reputation: 99

how can i move div in a horizontal line?

I would like to know how can i move 3 div's into a horizontal line? This is my code :

<div id="div1">
    <img id="poza1" src="http://s13.postimg.org/x0yjq2xxv/programare.jpg?noCache=13    97486136" />
</div>
<div id="div2">
    <img src="http://s11.postimg.org/axam9glov/administrare.jpg?noCache=1397486260" width="468" height="167" id="poza2" />
</div>
<div id="div3">
    <img id="poza3" src="http://s30.postimg.org/ly7cy5xrx/tacografe.jpg?noCache=1397486471" />
</div>

Thank you.

Upvotes: 0

Views: 161

Answers (4)

Matt from vision.app
Matt from vision.app

Reputation: 497

Just like Parag Tyagi said. I would only add a little bit of compatibility for IE 7 and 8:

.div1, div2, div3 {
    display: inline-block; *display:inline; zoom:1;
    /*optionally*/
    max-width:33.33%;
}

Don't ever use floats to position your elements (unless they should be actually floated) as you will run into many funky issues with alignment and such.

Upvotes: 0

JRulle
JRulle

Reputation: 7568

#div1, #div2, #div3 {
    float: left;
}

This works provided that the total width of all 3 DIVs is less than their parent (or the page)

Upvotes: 0

Rafayel A.
Rafayel A.

Reputation: 54

Use CSS floating:

<style type="text/css">
div {
   float: left;
}
</style>

Upvotes: 0

Parag Tyagi
Parag Tyagi

Reputation: 8960

Add following class to all 3 divs

.divs
{
    display: inline-block;
}

Upvotes: 4

Related Questions