djames
djames

Reputation: 49

Css not aligning paragraph correctly

I have the following code:

    <div class="copyright">
    <p>Copyright 2013 - All rights reserved</p></div>

    .copyright {
         margin-left: auto;
         margin-right: auto;
         font-family: 'NeouBold';
         font-size: 13px;}

For some reason, the margin-left and margin-right will not center the paragraph.

Like this: https://dl.dropbox.com/u/94786808/error.png

Upvotes: 0

Views: 71

Answers (3)

dkatwitt
dkatwitt

Reputation: 355

try:

.copyright {
    text-align: center;
     font-family: 'NeouBold';
     font-size: 13px;}

Upvotes: 0

pconline2046
pconline2046

Reputation: 30

you can try {margin:0 auto}

Upvotes: 0

Adrift
Adrift

Reputation: 59859

You need to give the div a width before centering with auto margins, as block-level elements take up 100% width by default

 .copyright {
 margin-left: auto;
 margin-right: auto;
 font-family: 'NeouBold';
 font-size: 13px;
 width: 300px;
 }

Upvotes: 2

Related Questions