200 likes | 391 Views
Changing Text with CSS. Styling Text. Can emphasize words on a page Change Font Size Indent Text Change the Font Change Text Alignment Control Line Spacing Control Letter Spacing Style a Bulleted List. Font Size. Example: h1 { font-size: 16pt; } Or h1 { font-size: 2em; }.
E N D
Styling Text • Can emphasize words on a page • Change Font Size • Indent Text • Change the Font • Change Text Alignment • Control Line Spacing • Control Letter Spacing • Style a Bulleted List
Font Size • Example: h1 { font-size: 16pt; } Or h1 { font-size: 2em; } • Accepts a variety of measurement units • Points = pt • Pixels = px • Millimeters = mm • Centimeters = cm • Inches = in • Picas = pc • Em Space = em 1em is equal to the current font size. The default text size in browsers is 16px. So, the default size of 1em is 16px.
Indent Text Example p { text-indent: 30px; } • Indents the first line in a paragraph • Gives it a more traditional look and feel • Can use: • mm, cm, in, pt, pc, em
Change the Font font-family: If Font name is more than one word have to use quotes around it. Can give more than one option in case they don’t have that particular font on their computer separate them with commas. Safe fonts: Arial, Verdana, Courier, Times New Roman
Change Text-Alignment Example h1 { text-align: center; } • Can choose: • Left • Right • Center • Justify
Control Text Spacing line-height: Adjust the space between lines • letter-spacing: • Adjusts the space between letters
Font-Style Make text italic Options: normal - The text is shown normally italic - The text is shown in italics oblique - The text is "leaning" (oblique is very similar to italic, but less supported) p { font-style: italic; }
Font-Weight Make text bold Options: • normal • text is displayed normally. This is default • bold • Defines thick characters • bolder • Defines thicker characters • lighter • Defines lighter characters p { font-weight: bold; }
Style a list Unordered List Ordered List • list-style-type: • lower-alpha • lower-roman • upper-alpha • upper-roman • list-style-type: • disc • circle • square • none Can also use an image instead: ul{list-style-image: url('sqpurple.gif');}