0

I have the following HTML code:

<div class="item">
    <div class="pageheader">
        Header
    </div>
    <div class="info">
        Created on...
    </div>
    <div class="image">
        Image
    </div>
    <div class="more">
        Read More...
    </div>
</div>

I can't change the order of the Elements and want to position it in this way without position absolute:

Div Position

Is there a way to do that so?

user2025830
  • 872
  • 2
  • 17
  • 37
  • Can you use Javascript, and if yes, jquery ? – singe3 Aug 22 '14 at 08:32
  • Why you cant change the order? – Dexkill Aug 22 '14 at 08:40
  • I can use jQuery, but I can't do changes in the html code because its auto generated from a Joomla Module and so I only can do changes in the css part. – user2025830 Aug 22 '14 at 08:42
  • @singe31 Why do you want to use jQuery to place div in correct position? You can easly do it with CSS – Piotrek Aug 22 '14 at 08:43
  • 1
    Considering this answer http://stackoverflow.com/questions/7425665/switching-the-order-of-block-elements-with-css , flexbox is the solution to change the order of your blocks. But it's a new CSS property so it's not supported in older browsers http://stackoverflow.com/questions/7425665/switching-the-order-of-block-elements-with-css . There is also a nice trick here that is cross browser I think http://stackoverflow.com/a/25309319/3805954 – singe3 Aug 22 '14 at 09:02

1 Answers1

3

EDIT:

.item{

    width: 400px;
    height:  100px;
    border: 2px solid black;
    position: relative;
}

.image{

    float: left;
    border-right: 2px solid black;
    height: 100px;
    width: 100px;

}

.pageheader{

    float: right;
    border-bottom: 3px solid black;
    height: 30px;
    width: 298px;
    top: 33px;
    left:102px;
    position: absolute;
}

.info{

    float: right;
    border-bottom: 3px solid black;
    height: 30px;
    width: 298px;
    top: 0px;
    left:102px;
    position: absolute;
}

.more{

    float: right;
    height: 30px;
    width: 298px;
    top: 66px;
    left:103px;
    position: absolute;
}

CSS solution, should work now.

Dexkill
  • 284
  • 1
  • 2
  • 20