CSS Menus and Rollovers. Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties-- List properties –Table properties-- Classification properties.
Advertisements

LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
15 LAYOUT Controlling the position of elements Creating site layouts Designing for different sized screens.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Layout using CSS. Using multiple classes In the head:.important{font-style:italic;}.title{color:red;} In the body: Here's a type of paragraph that is.
Today CSS HTML A project.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Slide 1 CMPS 211 Internet Programming Spring 2008 Dynamic Effects with Styles Chapter 12 2/6/08.
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.
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.
Links.  Styling Links  Links can be styled with any CSS property (e.g. color, font-family, background-color).  Special for links are that they can.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Session 4: CSS Positioning Fall 2006 LIS Web Team.
SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.
End User Computing An Introduction to CSS Sujana Jyothi Research Lab1, Callan Building, Department of Computer Science
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Sriram DRUPAL GCI What is a drop down menu? A drop down menu is a menu of options that appears when an item is selected with a mouse. The item.
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.
Navlang A JavaScript utility for navigation bars Paul Borokhov Brian Alker Motivation: Implementing good-looking CSS website navigation bars involves writing.
CSW131 Steven Battilana 1 CSW 131 – Chapter 5 (More) Advanced CSS Prepared by Prof. B. for use with Teach Yourself Visually Web Design by Ron Huddleston,
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
Chapter 8 Creating Style Sheets.
Today’s objectives Site performance Padding, Margins, Borders
Review of last session The Weebly Dashboard The Weebly Dashboard Controls your account and your sites Controls your account and your sites From here you.
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.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
Image Use. Agenda Ordinary display of image: height, width, alt Rollovers Images as links (remove blue surround) Background images: stretch, tile, xonly/yonly.
CA Professional Web Site Development Class 23 - CSS Positioning, Image Replacement & Print Styles.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Doman’s Sections Information in this presentation includes text and images from
End User Computing More on HTML and CSS Sujana Jyothi Department of Computer Science
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
CSS Class 2 -Add margins to elements on a page. -Set width and height of elements. - CSS shorthand properties for box model. -Style links. -Style tables.
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.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
Photoshop Image Slicing. Reasons to Image Slide To create links out of sliced images To optimise different areas. (flat areas of colour, such as logos,
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
By Lauren Mayer WEBSITE RESEARCH. NYLON MAGAZINE WEBSITE Header, this is the title of the website and should be the main attraction. This example had.
CONTROLLING Page layout
Microsoft Expression Web 3 – Illustrated Unit G: Designing Site Navigation.
ET-710 WEB-DESIGN By Bart Chuchro Queensborough Community College.
Learning Aim C.  Creating web pages involves many considerations.  In this section we will look at the different software tools you can use and how.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
INT222 – Internet Fundamentals Week 8: Using New HTML features 1.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
Web Design (17) CSS Box Element (2). ‘Box’ Web Site (1) Insert a navigation bar into the index.html file and create links to ‘index.html’, ‘pageone.html’
CSS Layouts: Positioning and Navbars
CSS Layouts: Grouping Elements
Advanced CSS BIS1523 – Lecture 20.
Cascading Style Sheets (Layout)
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
Fixed Positioning.
Web Development & Design Foundations with HTML5
Floating and Positioning
Web Development & Design Foundations with HTML5
Presentation transcript:

CSS Menus and Rollovers

Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs

Separating style from content It is considered good programming style to separate the information from its formatting. The information goes into the HTML file. The formatting goes into the CSS file. A good demonstration of this can be found in the site:

3 Pages in One File

3 pages in one file In many web pages the masthead remains the same from page to page, as does the menu. All that changes is the content. So we put the content for 3 pages onto the one page and hide two of the “pages”. We use CSS: – display: block; – display: none;

3 pages in one file Demo what it does (a-switch)

The menu links call a JavaScript routine When clicked, the link does not call a web page (“#”) Instead, it calls a JavaScript routine using a parameter (‘n0’ etc).

Here are the JavaScript functions The links call the function “display()”.

3 pages in one file The links call the JavaScript functions First the function “killall()” sets all content sections to invisible. Then the function “display(x)” selects the content section to make visible. That’s all folks:

Rollovers in CSS

The key to making rollovers work is to use the :hover pseudoclass as in: a:link a:visited a:hover

Rollovers with background colour

Demo (rollover, bgcolour)

Rollovers with background images

You simply define a different image in a:hover Demo

Rollovers with background images

Horizontal drop-downs

By this I mean a horizontal menu, from which a second menu drops down Demo (horiz-6)

Horizontal drop-downs We start off with a normal web page (demo html) We then use CSS to style everything except the menu (demo html+css). We want a horizontal menu, but we now have a vertical menu.

Horizontal drop-downs Next we flatten the menu (html+css-1), using: list style: none; margin: 0; padding: 0;

Horizontal drop-downs Next (html+css-2) we arrange the list elements horizontally by floating them to the left.

Horizontal drop-downs Next (html+css-3) we display all links as blocks of width 200px and height 30px. This spreads the top line along the menu bar. We also remove the underlines of the links using text-decoration: none;

Horizontal drop-downs Next (html+css-4) we stop the submenus from being displayed at all (we’ll get them back later). We also set the submenus to position absolute, so they will not disturb the rest of the layout when they do appear.

Horizontal drop-downs Here is an example of what happens when you don’t set the dropdown elements to position absolute: (demo try-index)

Horizontal drop-downs Next (css+html-5) we make the submenus appear when the menu elements are moused over. We use “hover” for that.

Horizontal drop-downs Finally (html+css-6) we style the submenus to make them look better. That’s it!

Vertical drop-downs

This section covers vertical menus with submenus which appear to the side. Perhaps “drop-down” is an inappropriate name.

We start with a standard HTML page (1-html)

We add CSS to put everything in the right place.

As usual, we put in CSS to hide the submenus normally, but display them when the main menu is moused over (demo 4-strict css).

We style the box, to give it a background colour. We give it a width and a position, which would cause it to interact with the content section, So we make the block absolute, so it sits on top of the content block. (5-strict css+style)

Finally we tidy up the page by adjusting the background colours. (6-tidy1)

Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs