Tuesday, 15 January 2013

javascript - Center DIV when positioned as absolute, with changing content in the DIV -


I have a website where I have a website on the website which is both vertically and horizontally centered, this current content is < Em> 25 and its centered work horizontally. If I change the content then I have to edit the width of width for width and margin-left . Every time you enter the website, this work And I need solutions for this.

How can I fix this? Can I possibly find out text width and width & amp; Can set; margin-left with js or jquery?

  #output {status: absolute; Top: 50%; Margin-top: -160px; Color: # 6FA673; Font: 200pt Elo; font-weight: bold; Left: 50%; Width: 296px; Margin-left: -148 pixels; }   

Thanks!

Edit: You have JSFDial for people! Works perfectly with 25 numbers, but something else will be small - vertical.

"post-text" itemprop = "text">

I've just seen your JSFID, meanwhile I've made something with HTML / CSS, what you saw Trying to know about (I'm a Simlar for Lightbox :) :)

Is it from you? #output, html, body {height: 100%; Width: 100%; Margin: 0; Display: Table; } Body {display: table-cell; Vertical-align: medium; Text-align: center; } #output {status: complete; Color: # 6FA673; Font: 200p aerial; font-weight: bold; Line-height: 0}

though not as fluid

No comments:

Post a Comment