Question:

Help with simple HTML and CSS

by  |  earlier

0 LIKES UnLike

How do I align to center this box border However you want to put it

<html>

<title>title</title>

<head>

<style>

body{

background:#080707 url(back_ground.gif) repeat-x top;

}

.poll {

background:#000000 url(Pollgrad.gif) repeat-x top left;width:790px;color:white;padding:5px... solid grey;

}

width: 100%;

height: 1px;

font-size: 1px;

color:white;

}

</style>

</head>

<body>

<div style="border:1px solid #2c2c2c;background:#2c2c2c; padding:5px;width:800px;align=right">

<div class="poll">

poll <hr>

<div style="text-align:center"> poll data

</div>

</body>

</html>

 Tags:

   Report

3 ANSWERS


  1. Im also not sure what you mean but try putting

    &lt;center&gt;

    CODE HERE

    &lt;/center&gt;

    Not sure if that&#039;s what you mean though.


  2. Not exactly sure what you are getting at here. This piece of code:

    &lt;div style=&quot;border:1px solid #2c2c2c;background:#2c2c2c; padding:5px;width:800px;align=right&quot;&gt;

    &lt;div class=&quot;poll&quot;&gt;

    poll &lt;hr&gt;

    &lt;div style=&quot;text-align:center&quot;&gt; poll data

    &lt;/div&gt;

    Needs an end tag for the upper level div. I suggest trying:

    &lt;div style=&quot;text-align:center;margin:0px auto&quot;&gt;

    for the second div.

    Excellent point by I8AShroom about ther doctype declaration.   I learned that the hard way several months ago. Without a doctype declaration my CSS wasn&#039;t behaving correctly.

  3. Assuming you want to center the first div add left and right margin of auto. You&#039;ll of course want to close the div as the other responder said and you&#039;ll want to fix or remove &quot;align=right&quot; from the style as that&#039;s not the correct syntax. You should also have a proper doctype declaration otherwise you&#039;re just forcing your pages into quirks mode which makes designing sites much more difficult.

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions