CSS: aligning overlays -
i'm trying create responsive design logo, using 2 strings, both transparent. strings in different sizes, second on top of first.
i've got want (try html below) right hand edge of 2 strings align - div extends width of browser , overlap changes width of display.
because want give browser choices on how it's rendered rather not use measurements in pixels.
if @ relevant - plan add additional elements either side of div.
<!doctype html> <html> <head> <style> .outertext { position: relative; font-family: arial,sans-serif; font-weight: 900; font-size: 800%; text-align:center; letter-spacing: -0.1em; color: red; opacity: 0.2; top: 0; left: 0; } .innertext { position: absolute; font-family: arial,sans-serif; font-weight: 900; font-size: 600%; text-align:right; letter-spacing: -0.1em; float: right; color: blue; opacity: 0.2; z-index: 1; right: 0; bottom: 0; } </style> </head> <body> , result is....<br /> <div style="position:relative"> <span class="outertext">outertxt</span> <span class="innertext">innertxt</span> </div> <hr /> ...nearly right - rt edges not (necessarily) aligned </body> </html>
update: jsfiddle here
you had typo in css ('postition' instead of 'position'), confusing things. also, think want remove "float: right" once typo fixed.
this seems (i think) wanted:
div { /* make selector more specific */ height: 150px; /* or whatever's suitable */ } .outertext { position: absolute; bottom: 0; right: 0; } .innertext { position: absolute; bottom: 7px; /* adjust desired compensate smaller font size */ right: 0; }
Comments
Post a Comment