• Resolved EnnisP

    (@ennisp)


    Hello All,

    I’m having trouble centering a DIV on my site. The stylesheet code is:

    #container {
    	width: 400px;
    	margin: 0;
    	padding: 0;
    	background: #999;
    } 
    
    .note {
    	width: 360px;
    	margin: auto 0px;
    	padding: 10px 10px;
    	background: #D8D8D8;
    	border: 1px solid #000;
    	text-align: justify;
    }
    #content .note p {
    	padding: 0;
    	Margin: 10px 10px;
    }

    And the HTML on the post is:

    <div class="note"><p>The following links access the most competitive prices. Using them helps defray expenses for this website.</p></div>

    An example of the DIV in a post here.

    Thanks for any help you can give.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try

    margin: 0 auto

    You have it the wrong way round.

    The usual order for margin length is top, right, bottom, left. The shorthand option to declare two lengths is top and bottom, left and right.

    Thread Starter EnnisP

    (@ennisp)

    Perfect!! Thanks very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CSS to Center a DIV’ is closed to new replies.