0
votes

i want my "body2" div in the center of the page and paragraph float left. but my code apply center align property on both dive. i have used float left for para in CSS but no solution.

<div class="row body2" align="center">

        <div class="writing">
            <div class="date">13.01.15</div><br>
            <div class="heading">My biggest audio project ever.</div>

            <div class="container-fluid">
            <div class="para">The complete setup took about 6 hours. We were extremely contended with the result taken into the account of everything is new. A late 
            </div><br><br>

            </div>
            </div>
    </div>

CSS: i am using text-align:left to make my paragraph left align, but it show center aligned.

.body2
{
    background-color: black;
    margin-top: -10px;
    margin-left: auto;
    margin-right: auto;
}
.writing
{
    margin-top:64px ;
    margin-left: 88px;
    padding-bottom: 50px;
}
.date
{
    color: #716558;
    font-family: myrid Pro;
    font-size: 20px;
}
.heading
{
    font-family: georgia;
    font-size: 36px;
}
.para
{
    margin-top: 40px;
    line-height: 170%;
    text-align:left;
}
4
please include your css - Mia Sno
Please post your code on codepen.io or jsfiddle.net so we can see your code and help you to fix it. - ilovebali
Just a little advice. Use the <p> tag for paragraphs. - JoJo
thanks @jojo i will follow - Farrukh Javed
If you are used align="center" that will bring your div center and also bring your text center, to override it set the text align on your style .body2{text-align:left} check here - ilovebali

4 Answers

0
votes

if you wanna align div in to the middle of page,

.body2{ width: 500px; margin: 0 auto;}

This will align your div in to the center of your page, change the width depend on your requirement.

to align text to left

.para{text-align:left;}

user this line, it should work good luck

0
votes

You can done by set the div margin auto .body2{margin:0 auto;text-align:left} and remove align="center" from <div class="row body2" align="center"> that cause your text is center, or set div body2 position absolute .body2{position:absolute; width: 300px; left: 50%; margin-left:-150px} that style will bring your div in the center of the page, hope that will help you

0
votes

The align property acts as text-align in this case. Instead, you can give your .body2 a non-auto width and apply margin: auto; to center the wrap: JS Fiddle

.body2 {width: 70%; margin: auto;}//can also apply max-width