user3638287 user3638287 - 2 years ago 112
CSS Question

Can't make a div float right (may be because of flexbox?)

Basically, got a container div in the middle of the page and 2 children divs. Need the right one to be at the very right of container. Float:right doesn't work. Can't use margin-left since i want it to work with any resolution. Right:0 doesn't work as well. Using flexbox. May be it has something to do with it.

html code

<div class="parent">
<div class="child1">adsfasdfdsa</div>
<div class="child2">192837192</div>

css code

.parent {
margin:0 auto;
.child2 {float:right;}

here is a fiddle

Answer Source

Use position:absolute; and right:11%

Here is what it looks like.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download