HTML - How To Center Div Box But Not The Text Inside
Similar Tutorialshere is the (ineffective) code currently: <img style="float: left; width: 169px; height: 73px;" src="img/logo1.png" alt="" /> <h1 style="text-align: center;">random text</h1> the image shifts the left margin such that the text is centered as though the page width was 169px less than it really is. i'm not debating the code itself; the code above behaves as its meant to. aka no surprises. i just cant figure out the appropriate code to center the text across the entire real width of the page as though there was no image. i've tried div tags & all the things google hunting advised. no luck. other than finding this forum, which seems like it'll be a boon! thanx in advance for advise/comments/feedback/help. I have found out that the <center> tag </center> is now obseolete eventhough broswers still display it. I was wondering on how i go about centering text so that it does validate according to xhtml standards. Thanks. Hello everyone, would someone please help me with just vertically centering the text within the box that says "This page was last updated on Monday, May 16, 2011 @ 10:39 AM" it's for my site located @ http://www.trillionaireme.com Here is my CSS code: Code: body {background-color:#ffffff;border-style:solid;border-width:5px;border-color:gray;border-bottom-color:#ffffff;border-left-color:#ffffff;border-right-color:#ffffff;} h1 {background-color:#f5f5f5;font-size:17px; color:grey; font-family:arial;word-spacing:30px;text-align:center;} h2 {font-size:17px; color:grey; font-family:arial;word-spacing:30px;text-align:center;} p {font-size:11px; color:grey; font-family:arial;} p.bordertop {border-style:solid;border-width:5px;border-color:gray;border-top-color:#ffffff;border-left-color:#ffffff;border-right-color:#ffffff;} p.borderbottom {border-style:solid;border-width:5px;border-color:gray;border-bottom-color:#ffffff;border-left-color:#ffffff;border-right-color:#ffffff;} IMG.displayed {display:block; margin-left:auto; margin-right:auto;} a:link {color:grey; text-decoration:none;} a:visited {color:grey; text-decoration:none;} a:hover {color:#c0c0c0; text-decoration:none;} a:active {color:#c0c0c0;text-decoration:none;} div.page {width:920px;padding:0px;border:0px;margin:0px auto;} div.logo {width:200px;padding:0px;border:0px;margin:0px auto;} div.topleftbox {width:250px;height:250px;padding:0px;border:1px;border-style:solid;border-color:#dcdcdc;position:relative;top:20px;left:1px;font-size:11px;color:grey; font-family:arial;} div.topmiddlebox {text-align: center;width:375px;height:25px;padding:0px;border:1px;border-style:solid;border-color:#dcdcdc;position:relative;top:-15px;left:270px;font-size:11px;color:grey;font-family:arial;text-align:center;margin-} div.toprightbox {width:250px;height:250px;padding:0px;border:1px;border-style:solid;border-color:#dcdcdc;position:relative;top:-15px;left:394px;font-size:11px;color:grey;font-family:arial;text-align:right;} My html code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><title>TrillionaireMe</title><link rel="shortcut icon" href="images/trillionaireme.ico"> <head><link rel="stylesheet" type="text/css" href="trillionaireme.css" /></head><body> <h1> </h1><div class="logo"><a href="http://www.trillionaireme.com"> <img class="displayed" src="http://www.trillionaireme.com/images/trillionaireme.jpg" width="196" height="233" border="0" /></a></div> <h1> </h1> <p class="borderbottom"> </p> <div class="page"><h2> <a href="http://www.trillionaireme.com/fitness.html">Fitness</a> <a href="http://www.trillionaireme.com/nutrition.html">Nutrition</a> <a href="http://www.trillionaireme.com/money.html">Money</a> <a href="http://www.trillionaireme.com/relationships.html">Relationships</a> <a href="http://www.trillionaireme.com/parenting.html">Parenting</a> <a href="http://www.trillionaireme.com/music.html">Music</a> <a href="http://www.trillionaireme.com/literature.html">Literature</a> <a href="http://www.trillionaireme.com/you.html">You</a> <a href="http://www.trillionaireme.com/them.html">Them</a> <a href="http://www.trillionaireme.com/vision.html">Vision</a></h2> </div> <div class="page"> <div class="topleftbox">This is the top left box. <div class="topmiddlebox">This page was last updated on Monday, May 16, 2011 @ 10:39 AM <div class="toprightbox">This is the top right box. </div></div></div></div> </body></html> hey guys, In order to align text isnt the command something like this? <h3 align="center">Text Here</h3> Is this right? I know its something really simple just for some reason I cannot get my text to center in the webpage. Any suggestions? Many thanks in advance! I am trying to do something pretty basic, but I dont understand the behavior or how to fix it. I want something to look like (where the '*' are centered): Code: * * test * * * * and am using the code: Code: <CENTER>*</CENTER> <CENTER>*</CENTER> test<CENTER>*</CENTER> <CENTER>*</CENTER> <CENTER>*</CENTER> <CENTER>*</CENTER> But the output looks like: Code: * * test * * * * when i center the search and quick link box at the top using a line height of 100.... it pushes the header image down 12px's... and spaces the header from the body of the page... any fix? http://www.pzproductions.com/home Hi I am very HTML newbe I want to put some text on the image but i cant This is the code i am using HTML Code: <table> <tr> <td> <img src="http://asmgx.webs.com/p1.jpg">My text should start from the red dot till the right border of the image, up to the bottom border to the image but as you can see it does not :(</img> </td> <td> <img src="http://asmgx.webs.com/p2.jpg">another text goes here</img> </td> <td> <img src="http://asmgx.webs.com/p3.jpg">another one too</img> </td> </tr> </table> This is how should my result look like can any one help me here? I'm trying to put text inside the body of an image. I've seen this done multiple times, but I have no idea where to start. An example of what I'm trying to do is: http://www.warriorwebinar.com/ Can anyone help? Thank you, Jim Im making a calendar table and i want to be able to change the color of the background depending on the status of the date. and i wanted to know were do i code the conditional statements to determine the color of the background? and hot do i make that text take me to a form when you click on it? thanks for the help, Tavo Hello, How can i make a combo box (<select>) where people can enter text on the first option? Thanks! I cant seem to create a border around a p tag when I have a image and text in the same p element/tag. Is this possible? Im pretty sure I have my syntax correct. Hi all, I have a table with some data in it. Sometimes the data in one of the cells fills up and it messes up the formatting of the rest of the table. I would like to have the table show a "...." when this happens and then when the user hovers his mouse over this then I want the remaining data to float over the table. Somewhat like a tooltip text. Is there anyway to do this? Thanks in advance for any help, Jehan Hello All, I am increasing the font size of the text using javascript. In IE, the div size increases or text get automatically wrapped when font size increased. But in firefox browser, the div size remain same and text flows out of the div. Anybody having any idea to correct his behavior in firefox? Please help. I am learning how to use Div's to replace Tables for layout. Needless to say, there are many properties I need to learn with CSS's. A friend wants a Floating area on the left which I have created, however I would like to have the box be centered in the main text area. Not sure if that can be done with my prototype at http://www.toddcary.com/viewpoint/div_todd_a.html Any help would be appreciated... Todd I am administering this forum www.br-eeze.com So please enter there as the flashing banner and the weather widgets. Both are positioned on the left. Now this is the code for the banner: <td align="center" valign="top" width="90" height="55"><A target = "_blank" HREF="http://www.br-eeze.com"><IMG SRC="http://www.xxx.com/test1.gif" border=0 width=728 height=90 ></a> As you can see I tried to center it. I even typed right but still everything is aligned to the left. PLEASE, how do I center the banner and the weather widgets? Hey felllas. I really need some help here. I'm building this page, but can't get it to center. I bet it's somethign dumb I'm overlooking. could you please take a quick look at the source and LMK what I'm missing... http://bravoad.com/BravoTest2.html Thanks in advanced Quick question. When using a generator to make a website, it seems that usually everything is placed into "DIV - ABSOLUTE" codes. How do I center everything up so it isn't all stuck to one side for users who have a higher resolution? <tr> <td class="contentarea_b"></td> </tr> <h3>=WFC= WAR FORCE CLAN AMERICAS ARMY</h3> <table cellpadding="0" cellspacing="0" border="0"><tr><td><object type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId=4279961105245592436&hl=en" height="350" width="425" style="width:400px; height:326px;" id="VideoPlayback"> <param name="movie" value="http://video.google.com/googleplayer.swf?docId=4279961105245592436&hl=en" /> <param name="allownetworking" value="internal" /> <param name="allowScriptAccess" value="ALWAYS" /> <param name="enableJSURL" value="TRUE" /> <param name="enableHREF" value="TRUE" /> <param name="saveEmbedTags" value="true" /> <param name="flashvars" value="" /> </object></td></tr><tr><td> </table> </td> Hey im new at this html programming and im ok at it but i still need to learn more i need help centering the stuff on my page you will see what i mean if you go to my website. firefoxskins.awardspace.com. I would really like help thank you for your time. http://www.ivoog.com/test/help The boxes that have: Paypal, Policies, Financing, Wholesale, etc. How can these be centered in all browsers including IE6? I can't get it to work Here's the CSS: #othermain2 { width:850px; height:850px; float:left; } #middlestyle { width:850px; text-align:center; margin:auto; overflow:auto; } .middlebox { width:150px; text-align:center; float:left; font-size:24px; margin-left:50px; margin-top:50px; border:solid 5px #333; } .middlebox:hover { width:150px; text-align:center; float:left; font-size:24px; margin-left:50px; margin-top:50px; border:solid 5px #390; } FULL CSS: http://www.pics.ivoog.com/page/home.css Can anyone help me? Thanks. |