Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIT 256 CSS Divs & Buttons Dr. Beryl Hoffman. CSS for Layout We now can make our own divs to divide up a web page : Header Header Navigation Navigation.

Similar presentations


Presentation on theme: "CIT 256 CSS Divs & Buttons Dr. Beryl Hoffman. CSS for Layout We now can make our own divs to divide up a web page : Header Header Navigation Navigation."— Presentation transcript:

1 CIT 256 CSS Divs & Buttons Dr. Beryl Hoffman

2 CSS for Layout We now can make our own divs to divide up a web page : Header Header Navigation Navigation Content here Content here Footer Footer

And we can add new CSS rules for each and for the body tag.

3 Review: New CSS Rule in Dreamweaver Hit the + button at the bottom of the CSS panel on the top right. –ID: used once, use for divs –Class: can be used many times. –Tag: for html tags like –Tag: for html tags like –Compound: like –Compound: like Choose New Style sheet first time, add to style sheet after that.

4 Review: Edit CSS Div Rules Type: for font, text color Background: background color or image Box: for width/height, margins, padding! To re-edit, double click on a rule like header in the CSS panel on the top right or hit the pencil icon at the bottom of the panel.

5 Review: Insert CSS Divs in Dreamweaver Insert/Layout Object/Div Tag (or just type them in ) Click on the New CSS Rule button at the bottom or type in an id like header and design the style later in the CSS panel.

6 CSS for 2 Column Layout The nav div can be styled to be at the top or the side using CSS Header Header Navigation Navigation Content here Content here Footer Footer

Float navbar to the left and set its width to 20% (in Box). Nav Content

7 CSS Float property Makes a div element float to the left or right of its container. The floated element always needs a width! See and sp (and first Try It Yourself) sphttp://imagecss.com/ sp

8 2 Col CSS Layout in Dreamweaver Insert/Layout Object/Div for the container, header, sideNav, content, footer, etc. Set the container to 80-90% width and left/right margin auto, margin-top:0 Set #navbar { float: left; width: 20%; }  Box Set #content { margin-left: 20%; } Set #footer { clear: both; // to clear float width: 100%; } width: 100%; } Make sure there is no tag starting in the content div!

9 Side Nav Links Type in Text, make them into links. Many web designers put the links into an unordered list (we won’t).

    Home Home Page1 Page1
We will add a style to the links to make them into buttons.

10 CSS3 Text made into buttons Buttons and nav bars without images can be created using CSS including rounded corners (border radius), shadows, gradients, etc. Advantages: Easy to change text. No extra images. No Photoshop necessary. Drawback: different browsers do the CSS differently so lots of CSS code variants.

11 CSS Button Generators CSS3 Button Generators (don’t use IE): – –http://www.cssbuttongenerator.com/ – –http://css-tricks.com/examples/ButtonMaker/,http://css-tricks.com/examples/ButtonMaker/ – –http://cssmenumaker.com/ Copy the generated CSS into your CSS file. You may have to add width: 20% or 200px. Type in text, make it into a link and then choose your button class name from the Class: menu at bottom.

12 Advanced CSS: Make your own Simple CSS Button Create a new CSS rule (+) for your button. Type: set font, text color, text decoration: none Background: set background color Block: display:block Box: see next slide

13 CSS Box Model From See also del.asp del.asphttp://imagecss.com/ del.asp

14 CSS Buttons Cont. Box tab: –Width: 100px or 15%-20%, 15%-20%, – Float: Left, –Uncheck Padding and Margin same for all –Set left/right padding to 10-20px (this is the button’s width around the text) –Set left/right margin to 5-10px (this is the space between this button and other buttons). Border: solid, color

15 Rounded Corners border: 2px solid; or background color and border-radius: 10px; // most current browsers -moz-border-radius: 10px; // for old firefox -webkit-border-radius: 10px; // for old safari See tricks.com/almanac/properties/b/border- radius/ tricks.com/almanac/properties/b/border- radius/http://css- tricks.com/almanac/properties/b/border- radius/

16 Box-Shadows Use Creates a drop box look around the button. box-shadow:inset 0px 1px 0px 0px #ffffff; -moz-box-shadow:inset 0px 1px 0px 0px #ffffff; -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff; shadow.asp shadow.asp

17 Gradients Use or background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color- stop(1, #dfdfdf) ); background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); filter:progid:DXImageTransform.Microsoft.gradi ent(startColorstr='#ededed', endColorstr='#dfdfdf');

18 Make your own Text Logo with CSS Text Shadows Text-shadows work in all browsers except IE. Add the property at the bottom of the CSS panel properties. Choose 2px for x & y offsets and blur and choose a different color. _text-shadow.asp _text-shadow.asp 06/29/full-css3-text-shadows-even-in-ie/ 06/29/full-css3-text-shadows-even-in-ie/

19 CSS3 Fonts CSS3 allows you to download or link to any font to use it! rule: rule: _fonts.asphttp://www.w3schools.com/css3/css3 _fonts.asp is the best way! Just link to their fonts. Choose a font and click on Use button to generate the code to add to your page to use that font.

20 Summary Use CSS and divs for layout using Box properties and floating. CSS3 has the power to do a lot of things that used to be done in Photoshop graphic images: text shadows, box shadows, fonts, gradient colors, rounded corners, etc. But browser-dependent code is a pain! So, use online generators like


Download ppt "CIT 256 CSS Divs & Buttons Dr. Beryl Hoffman. CSS for Layout We now can make our own divs to divide up a web page : Header Header Navigation Navigation."

Similar presentations


Ads by Google