SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.

Slides:



Advertisements
Similar presentations
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Today CSS HTML A project.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Very quick intro HTML and CSS. Sample html A Web Title.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
FORMATTING IN CONTEXT. FOLLOW UPS ANCHOR POINTS MUST BE UNIQUE  If you have more than one, how does it know where to go?  They can be repeated across.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
CSS Menus and Rollovers. Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Navigation Bars Level 2 Extended Certificate Unit B12 Doing Business Online.
CSS(Cascading Style Sheets )
Navlang A JavaScript utility for navigation bars Paul Borokhov Brian Alker Motivation: Implementing good-looking CSS website navigation bars involves writing.
1 Dreamweaver CS5 intermediate class by Cookie Setton Build a CSS website WITHOUT TABLES Just when you thought you were starting to understand HTML coding,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
Unit 20 - Client Side Customisation of Web Pages
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Tutorial 4: Creating page layout with css
Chapter 9. Links  When styling a link, you must tell CSS both what you want to style, and when you want the style to happen  Web browsers keep track.
Introducing Cascading Style Sheets  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles  Text Formatting with CSS.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Tutorial 6 Creating Tables and CSS Layouts. Objectives Session 6.1 – Create a data table to display and organize data – Modify table properties and layout.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
Doman’s Sections Information in this presentation includes text and images from
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
Adding Graphics to Web Pages. CSS does not have any properties specifically aimed at formatting images Use properties you have already learned, i.e.,
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
XHTML and CSS. The Browser The browser is not print!
IT Introduction to Website Development Welcome!
Introducing Cascading Style Sheets. Cascading Style Sheet Basics  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Principles of Web Design 6 th Edition Chapter 9 – Site Navigation.
Web Development & Design Foundations with HTML5 7th Edition
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Positioning Objects with CSS and Tables
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
 Add one element at a time  If it doesn’t do what you want, › Delete it › DON’T just keep piling on more items.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Working with Cascading Style Sheets
Cascading Style Sheets™ (CSS)
CSS Layouts: Positioning and Navbars
Cascading Style Sheets (Layout)
Cascading Style Sheets
Fixed Positioning.
Web Client Side Technologies Raneem Qaddoura
Introduction to Cascading Style Sheets (CSS)
Cascading Style Sheets™ (CSS)
Presentation transcript:

SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall

SM5312 week 11: CSS Menus & Navigation Bars2 Navigation Bars The main menu or main navigation bar is a core element of any web site design. Creating a clear and recognisable visual style for a navigation bar is important for a user-friendly site The two most common ways to display navigation bars these days are: Vertically Horizontally

SM5312 week 11: CSS Menus & Navigation Bars3 Navigation Bars Vertical navbars can take the form of buttons or small panels, or even plain text links with a simple border. Horizontal navbars can take the form of buttons or tabs;

SM5312 week 11: CSS Menus & Navigation Bars4 Navigation Bars in XHTML Creating a Navigation Bar in HTML is easy: Just a simple unordered list, with each element enclosed in a hypertext link element. Home Products Services About Us Contact Us

SM5312 week 11: CSS Menus & Navigation Bars5 However, its normal to “wrap” your navigation list in a div element with a specific ID name: This allows us to apply specific styling to the ul, li, and a sub-elements without affecting the rest of the page styling. Navigation Bars in XHTML Home Products Services About Us Contact Us

SM5312 week 11: CSS Menus & Navigation Bars6 Navigation Bars in CSS: images With the basic XHTML ul list in place, we can set about styling the list into a well-defined navigation bar. A lot can be done with simple border and background colour styling. However, we can also use images for a more button-like, or tab-like look and feel.

SM5312 week 11: CSS Menus & Navigation Bars7 Navigation Bars in CSS: images For a simple rollover button effect, we only need 1 image: We can combine the ‘off’ state and the ‘on’ state (or rollover state) in one image. Unlike javascript-enabled buttons, we don’t need to put any text in our button images. The text on top comes directly from text in the ul list in the XHTML.

SM5312 week 11: CSS Menus & Navigation Bars8 Navigation Bars in CSS: images For a tab effect, we can use 2 images: One image for the ‘selected’ or ‘front-most’ tab. One image with some bottom shading for the ‘unselected’ or ‘recessed’ tabs. (Its also possible to use the single image format for tabs too, depending on tab spacing and how you want your tabs to look)

SM5312 week 11: CSS Menus & Navigation Bars9 Navigation Bars in CSS: Key Properties For the ul element, we simply set the margins and padding to 0, and set the list-style-type to ‘none’. This turns off all bullet and indent styling We then apply most of the styling to the ul a element (descendent selector; the a element inside the ul element)

SM5312 week 11: CSS Menus & Navigation Bars10 Navigation Bars in CSS: Key Properties #navbar ul a { display: block; width: 200px; height: 40px; line-height: 40px; background: #CCCCCC url(images/menubase_1.png) no-repeat left bottom; text-align: center; } Forces an inline element to act like a block element Fixed width and height to match dimensions of image Forces text to vertically align centre Loads the button image in the background of the block and tells it to align with left and bottom edges

SM5312 week 11: CSS Menus & Navigation Bars11 Vertical & Horizontal Navigation Bars The previous CSS rule will produce a vertical nav bar, i.e with each button stacked vertically. To create a horizontal nav bar, we can either change the display property to ‘inline’ (from ‘block’), or tell the li elements to float left; #navbar ul li { float: left; } This second property is preferable, because the display:inline; property is not reliable in some browsers.

SM5312 week 11: CSS Menus & Navigation Bars12 Nav Bar Hover or MouseOver Effect The hover or mouseover effect is applied to the a:hover property, as a descendent selector of #navbar; #navbar a:hover { color: #fff; text-decoration: underline; background-position: right bottom; } Forces the image to align to the right edge of the block element, thereby exposing the dark blue or ‘highlight’ section of the button graphic.

SM5312 week 11: CSS Menus & Navigation Bars13 Nav Bars in Practise Copy these files from the SM5312/Tutorials Folder: hong_kong_with_image.html hongkong3.css /images (the whole images folder) Copy these to your tutorial site root folder (i.e. the root folder you have defined in Dreamweaver). Replace any existing folders and files with the same names. (Optional: copy the /PSDs folder)