html - CSS - align element to the right of a centered div without overlapping/absolute positioning? -


so i'm sure question has been asked before couldn't figure out looking through answers. have div centered max width of 900px. want small div right of it, don't want push centered div left/cause other havoc. managed using absolute positioning on element want right , pushing down padding top, don't solution feel shouldn't have pad want it, , if shrink window on huge screen text in absolutely positioned element overlaps centered element. centered element image, , right aligned element aligned horizontally top edge of image. classes like(image element want in center, info 1 want right):

.image {     max-width: 900px;     display: block;     margin:auto;     padding-bottom: 2em;     position: relative; } #info{     position: absolute;     right: 0;     top: 10em;     margin: auto; } 

thanks , sorry if redundant question. edit: here fiddle: http://jsfiddle.net/7xmq6/

without fiddle can't sure, sounds inline-block asking. make both centered div , 1 right of inline-blocks vertical-align set top , align next each other, if there horizontal room, otherwise wrap next line , stack.

.image, #info {   display: inline-block;   vertical-align: top; } 

for work, must siblings , #info must come second in dom

<div class="image">...</div> <div id="#info">...</div> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -