keevitaja Posted October 31, 2009 Share Posted October 31, 2009 is it possible to make a part of the text be displayd left and another part right? or i must put 2 additional divs with float left? i need the with be 100%. how can i do it? Quote Link to comment Share on other sites More sharing options...
keevitaja Posted October 31, 2009 Author Share Posted October 31, 2009 and how can i align middle my text inside a div? vertical-align is no tworking Quote Link to comment Share on other sites More sharing options...
Chezshire Posted October 31, 2009 Share Posted October 31, 2009 Hi Keevitja -- I don't understand your first question, but a trick i use to center my text vertically is as follows using the CSS font-property 'font'. Here is an example: font: normal 10px/26px That specifies the font size as 10 pixels, but centers it in a div of 30 pixels (I don't know why this works exactly but it does - you have to play with it to get your sizing - but the lower the second number, the higher the type will sit in the box basically. I hope I'm explaining that well enough for you to understand (and i'm a newb, so take my advice for what it's worth). -Chez Quote Link to comment Share on other sites More sharing options...
keevitaja Posted November 1, 2009 Author Share Posted November 1, 2009 how can i make textbox go right and text inside a textbox also right + middle <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } #container { background-color: #99F; height: 300px; width: 500px; margin-top: 20px; margin-left: 40px; text-align: right; } #textbox { width:200px; height:150px; background-color:#993; text-align: right; vertical-align: middle; } --> </style> </head> <body> <div id="container"> <div id="textbox">this is a text box</div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
lostprophetpunk Posted November 1, 2009 Share Posted November 1, 2009 You can use paragraph tags and float. p.left-text { float: left; width: (the number you put here must be less than half the width of your div); } p.right-text { float: right; width: (the number you put here must be less than half the width of your div); } <div id='nameofyourdiv'> <p class='right-text'>Right Text</p> <p class='left-text'>Left Text</p> </div> I have tested the code and it works. Quote Link to comment Share on other sites More sharing options...
keevitaja Posted November 1, 2009 Author Share Posted November 1, 2009 is it possible to position everything in virtically middle? like it is default in <td> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.