Search code examples
cssmarginparagraph

How to add a margin on both sides and center the text in a paragraph?


http://img.cmsszablony.pl/images/2014/02/12/paragraphs_helps.png - image to help

How to add margin left and right on both sides and middle text in line with text on right side? Please answer my question.

This is my code HTML:

<div class="row1 gensmall wrap">        
<p class="alignleft">{TOTAL_USERS_ONLINE}<br />{TOTAL_USERS}{TOTAL_FEMALE}{TOTAL_MALE}{COUNTER}</p> 
<p class="alignright">{POSTED_TODAY}<br />{USERS_OF_THE_DAY_LIST} {USERS_OF_THE_DAY_COUNT}</p>
</div>

And CSS:

.wrap {
display: table;
width:100%;
}
.alignleft {
    float: left;
}
.alignright {
    float: right;
    text-align:right;
}

Please to help me.


Solution

  • I'm not sure if this is what you want.

    Sample

    just add this in your CSS

    p{
        margin:10px;
    }
    

    Note: Just resize the window if the text breaks.