html - Centering multiple <p> tags within in a div -
i have several different sections in i'm trying center set of tabs. 1 set of tabs i've tried put in unordered list , other set i've tried several <p>
tags within <div>
nothing seems working. know others have had problem haven't been able find apologize if repetitive question.
i've tried <position: absolute>
, <display: inline>
, , others. can't seem it. in advance!
also, they're not supposed functioning tabs @ moment because don't want have worry jquery right now, supposed them!
html
<!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/default.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <title>starship chronicles</title> </head> <body> <div id="container"> <div id="header"> <h1>starship chronicles</h1> <p id="topmenu">search - faq - feedback - about</p> </div> <div id="ships"> <!--ships go here--> </div> <!--this section area tabs attach boxinfo--> <div id="tabs"> <ul id="tabs"> <li id="tabs">overview</li> <!--link div id="geninfo"--> <li id="tabs">stats</li> <!--link div id="statsinfo"--> <li id="tabs">images</li> <!--link div id="imagesinfo"--> <li id="tabs">context</li> <!--link div id="contextinfo"--> </ul> </div> <!--need figure out how place different information in same box when click on separate tabs--> <div id="geninfo"> <table> <tr> <td><p class="info">ship name:</td> <td><span class="text">recursant-class star destroyer</span> </p></td> </tr> <tr> <td><p class="info">alliance:</td> <td><span class="text"> commerce guild</span> </p></td> </tr> <tr> <td><p class="info">origin:</td> <td><span class="text"> star wars</span> </p></td> </tr> <tr> <td><p class="info">size:</td> <td><span class="text"> 1,187 meters </spam></p></td> </tr> </table> </div> <div id="bottommenu"> <!--this scale--> <p id="length">0m-479m</p><p id="length">480m-1299m</p><p id="length">1300m-1999m</p><p id="length">2000m-4999m</p><p id="length">5000m+</p> </div> </div> </body> </html>
css
body { background: url(../images/spacebg.jpg) no-repeat fixed ; } #container { width: 100%; height: 100%; } #header { width: 50%; height: 100px; border: solid 1px #0071bc; background-color: transparent; margin-left: auto; margin-right: auto; text-align: center; } #info { margin-left: auto; margin-right: auto; position: relative; } #geninfo { margin-top: 100px; width: 35%; height: 200px; background-color: #000000; border: solid 1px #0071bc; margin-left: auto; margin-right: auto; padding: 5px; } /*tab shape*/ #tabs { color: #000000; font-family: dinblack; text-align: center; background-color: #0071bc; width: 100px; text-decoration: none; } #tabs ul { list-style-type: none; padding: 0px; margin: 0px; } #tabs li { margin: 0 0.5em 0 0; } h1 { color: white; font-family: oratorslant; font-size: 50px; margin-left: auto; margin-right: auto; } #topmenu { color: #ffffff; font-family: dinblack; font-size: 15px; } table { padding: 0px; margin: 0px; line-height: 1px; } /*h2*/ .info { color: #0071bc; font-size: 25px; font-family: captain; } /*infotext*/ .text { color: #0071bc; font-size: 18px; font-family: dinreg; } #bottommenu { position: absolute; bottom: 5px; display: inline-block; } #length { color: #000000; font-family: dinblack; text-align: center; background-color: #0071bc; display: inline-block; margin: 5px; width: 200px; height: 20px; }
to horizontally center p's within div, can make parent div text-align: center;
, , inner p's display: inline-block;
inside of #bottommenu, remove absolute positioning (there better ways place footer), , add text-align: center
many possible duplicates, such this one
Comments
Post a Comment