html - Attach div to the right of another div -
i have div container , inside of there 2 images. 1 image on left side of div , other on right. container bootstrap's container
both of them wrapped div, , div's position
fixed
.
my problem can't locate right image attached right side of conatiner. tried float
, right
properties not give expected result.
how can attach div right of div?
if i'm understanding problem correctly, have large container fixed position. left div on inside of container sticks inside left, , right div inside container sticks inside right?
you can set display inline-block force them side side, , use left/right position them within container:
html:
<div class="container"> <div class="left-element"> left </div> <div class="right-element"> right </div> </div>
your css this:
.container { width:500px; position: fixed; } .left-element { background: green; display: inline-block; position: absolute; left: 0; } .right-element { background: red; display: inline-block; position: absolute; right: 0; }
jsfiddle: https://jsfiddle.net/mqwbcln8/3/
Comments
Post a Comment