css - Offset div from center -


i'm trying position div x amount of pixels right of center of page. div therefore relative center.

so far, i've tried stupid like

margin:0 auto; margin-left:20px; 

but don't need test in browser know wouldn't work.

thanks in advance help.

i'd try using 2 divs, 1 inside another. this:

<div class="outer">     <div class="inner">hello, world!</div> </div>  .outer {     width: 1px; /* or zero, or small */     margin: auto;     overflow: visible;     background: red; /* color debug */ } .inner {     margin-left: 20px;     background: yellow; /* color debug */     width: 100px; /* depending on desired effect, width might needed */ } 

see this example live @ jsfiddle.

the outer div horizontally centered per question/answer: how horizontally center <div> in <div>?

then, inner diff moved 20 pixels right, using margin.

note that, if leave width auto, width zero, , might not want.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -