I Figured Out How To Center And Justify Paragraphs (CSS)
1 post
• Page 1 of 1
I Figured Out How To Center And Justify Paragraphs (CSS)
Have you ever wanted to put text in the center of your page, yet have it lined up all nice and pretty? Try this:
The key to this is “margin-left: 30%;” line. You can change the 30% to whatever suits your web page. Also, lets say you want both normal paragraphs and centered/justified paragraphs. You can make a heading to look as a paragraph and act centered and justified like this:
By setting the font-weight to normal and font-size to the same size as your paragraph, it can look like your paragragh and be centered and justified.
I don't know if this will help anybody, but I spent a good bit of time figuring this out for a web site so I thought I'd share.
- Code: Select all
p {
margin-left: 30%;
font-family: sans-serif;
font-size: 0.875em; /*14px*/
color: black;
}
The key to this is “margin-left: 30%;” line. You can change the 30% to whatever suits your web page. Also, lets say you want both normal paragraphs and centered/justified paragraphs. You can make a heading to look as a paragraph and act centered and justified like this:
- Code: Select all
h3 {
margin-left: 30%;
font-family: sans-serif;
font-size: 0.875em; /*14px*/
font-weight: normal;
color: black;
}
By setting the font-weight to normal and font-size to the same size as your paragraph, it can look like your paragragh and be centered and justified.
I don't know if this will help anybody, but I spent a good bit of time figuring this out for a web site so I thought I'd share.
-
Server Tony
- Site Admin
- Posts: 14
- Joined: Wed Jul 03, 2013 1:05 pm
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest