Help:Wiki University Wikitext--Alignment

Centering titles
Often you may want to center a title rather than allow it to remain in the default position on the left. So how do you center a title? We use the attribute:  text-align: center Here is the coding with a border, which will not be shown in the coding, so you can see the alignment:  This title is centered This title is centered
 * This attribute works for headings, paragraphs and div tags.

Right or Left
This alignment attribute also can be for to the left or right like so: Here is the coding:  This title is on the right This title is on the right Here is the coding:  This title is on the left This title is on the left text-align: right text-align: left

Up or down
We place some text in a div or paragraph tag that is taller than the text and we want the text to be in the middle of the container, we use the line-height attribute.  This text is in the middle This text is in the middle
 * Let's make a container or box with a div tag that is 50px in height. We can place the text in the center, but it is at the top of the container.
 * If we want the text in the middle of the container we will add the line-height attribute and make it the same height as the container.
 * So when you combine the text-align with line-height, the text will be in the middle of the container. Here the code where you set the line-height to 50 pixels to equal the height of the container that is 50 pixels high.

Try these out


 Exercises Check your answers
 * Take this title: "I Love Wikitext" and put it on the center of the page.
 * Take this title: "I Love Wikitext" and put it on the right of the page.
 * Take this title: "I Love Wikitext" and put it on the left of the page.

 Quick Quiz
 * Text-align only works in header tags
 * A. True
 * B. False


 * Text-align cannot put a title to the left because that is the default position.
 * A. True
 * B. False


 * Text-align will work in header, paragraph and div tags
 * A. True
 * B. False

Check your answers