Answer the question
In order to leave comments, you need to log in
How to do center alignment?
<div class="copyright" > © 2012-2015 год. <a href="http://moguta.ru">Moguta.CMS</a></div>
Answer the question
In order to leave comments, you need to log in
Alexandra Bashura : you have float: left, that is, to the left edge. and your margin is 25px from the left edge.
put:
text-align: center ;
so that the text inside the block is centered.
Write:
margin-left: auto ;
margin-right: auto ;
and specify the width of your block.
.copyright{
text-align: center;
width=100;
margin-left: auto ;
margin-right: auto ;
}
You don't need to align the text inside div.copyright, but the div.copyright itself relative to the footer
Do this:
.copyright {
margin: 25px auto 0 auto;
}
Width alignment is done like this:
CSS rule - text-align: center
This will align the text in the center of one block
Height alignment is done in several ways, the easiest to understand is to insert a table into the block and specify a width-height of 100%. Vertically align text in a table cell.
If you need to center the block itself, you can think of it as an inline-block (simplified, the browser will think that your block is a letter), and then align it as above.
If you have additional questions: write to skype gzhegow, or email [email protected]
Advisors with bad methods and extra text, why do you teach beginners the wrong way?
To align text in a block, just write text-align: center; and that's all
In the author's example for beauty, I would add another padding: 10px 0; so that Djamal Nasrutdinov doesn’t
stick and yours were used in the 90s when tables were relevant, etc., well, judging by your advice, you also typeset, now everything can be done with the help of styles, without extra html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question