210 likes | 332 Views
Creating Page Layouts with CSS. Part 2 Margins, Padding, and Borders. Setting Margins and Padding. Margin Styles margin-top: length; margin-right: length; margin-bottom: length; margin-left: length; Or margin: top right bottom left;
E N D
Creating Page Layouts with CSS Part 2 Margins, Padding, and Borders
Setting Margins and Padding • Margin Styles • margin-top: length; • margin-right: length; • margin-bottom: length; • margin-left: length; • Or margin: top right bottom left; • Or if you want all the margins to be the same then just margin: length;
Open up cp_reset.css • In the body selector add in: • margin:10px;
Padding Styles • padding-top: length; • padding-right: length; • padding-bottom: length; • padding-left: length; • padding: top right bottom left; • padding: length;
cp_reset.css • Add to the body • padding: 0px; • cp_styles.css • Add to nav.horizontalNAV li • padding: 15px 0px; • This is like saying padding: 15px 0px 15px 0px;
cp_styles.css • Formatting the headings in the president’s message
cp_styles.css • Setting the paragraph • 40% of the width of the president’s message to the right • Adding a background image
Displaying the vertical list • cp_reset.css • Remove • nav.verticalNAV and all its parts • cp_styles.css
Working with Borders • Setting Border Width and Color • border-top-width: width; • border-right-width: width; • border-bottom-width: width; • border-left-width: width; • border-width: top right bottom left; • border-top-color: color; • border-right-color: color; • border-bottom-color: color; • border-left-color: color; • border-color: top right bottom left;
Setting the border design • border-top-style: style; • border-right-style: style; • border-bottom-style: style; • border-left-style: style; • border-style: top right bottom left; • Styles • Solid, dashed, dotted, double, outset, inset, groove, ridge, none
Creating Rounded Corners • border-top-left-radius: radius; • border-top-right-radius: radius; • border-bottom-right-radius: radius; • border-bottom-left-radius: radius; • border-radius: top-left top-right bottom-right bottom left;
cp_styles.css • #president • The first two lines you see in this are browser extensions for other browsers. You will also notice you get the green line underneath, that is because not all development kits support things that are in HTML5 you will see difference between IE and other browsers.
Using the outline style • outline-width: value; • outline-color: color; • outline-style: style;
cp_styles.css • To help see they layout structure of the site add this to the style sheet. • Take a look at the page and then go back in and take this out so we don’t forget. • To really see the whole page as we work on it go into the cp_reset.css file and remove all the things that we are temporarily hiding.