html - Trying to position text specifically with CSS, and allow it to move with the page -


<!doctype html> <html> <head>  <style type="text/css"> p.titletext { font-family:"arial"; font-size:50px; position:relative; left:425px; top:10px; } </style> </head>  <body> <p class="titletext">hello world.</p>  </body> </html> 

i'm asking whether there's can handle text positioning keep text in position while page being expanded/contracted. in other words, want text positioning following according page size. example, if make new paragraph , align center, no matter how large or small window is, text stay in center. there way accomplish while setting text position liking?

try way

body{text-align:center;} p.titletext { font-family:"arial"; font-size:50px; } 

update:-for both horizontal , vertical

<style type="text/css">  p.titletext { position:absolute; top:50%; left:50%; height:2em; margin-top:-1em; width:40%; margin-left:-20%;text-align:center;  font-family:"arial"; font-size:50px; } </style>  

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -