css - Align Inline Element to the Right -


how align 2 text elements, 1 left , other right, on same line. i'm aware can done using floats float less solution. i'm looking way using display:inline.

html:

<div class="contailner">     <div class="inlineleft">item 1</div>     <div class="inlineright">item 2</div> </div> 

css:

.container {     width: 600px;     border: 1px solid blue; }  .inlineleft, .inlineright {     display: inline; }  .inlineright {     ...align right...    } 

you use position:absolute on inline elements , position:relative on container. can align inline elements way want relative container. this:

.container {     position: relative;     width: 600px;     border: 1px solid blue; }  .inlineleft, .inlineright {     position: absolute;     display: inline; }  .inlineright {     right: 0; } 

demo


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -