CGS 3066: Web Programming and Design Fall 2019 CSS Extra

Slides:



Advertisements
Similar presentations
Very quick intro HTML and CSS. Sample html A Web Title.
Advertisements

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.
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.
Session 4: CSS Positioning Fall 2006 LIS Web Team.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red“ Example h1.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Need to define two things: › The destination › Something to click on to get there  Tag is click here  Can be text, special character or image (next.
กระบวนวิชา 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.
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
ALBERT WAVERING BOBBY SENG. Week 3: CSS  Quiz  Announcements/questions/etc  Homework.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
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.
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.
Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ CSS Training.
CSS: Cascading Style Sheets Part II. Style Syntax.
IN THE DOCUMENT OBJECT MODEL, EACH LINE OF HTML IS AN ELEMENT (AN OBJECT), ABLE TO HAVE ATTRIBUTES, PROPERTIES AND VALUES. CSS TELLS THE BROWSER HOW TO.
Advanced CSS. Display  Hiding an element can be done in two ways  display:none  Element is hidden and will no longer take up space on the page  Can.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
WebD Introduction to CSS By Manik Rastogi.
Laying out Elements with CSS
Cascading Style Sheets Layout
CSS Layouts: Positioning and Navbars
Semester - Review.
Unit 3 - Review.
HyperText Markup Language
Webpage layout using CSS
UNIT-II CSS.
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
Cascading Style Sheets
Chapter 3 Style Sheets: CSS
Floating & Positioning
Cascading Style Sheets
Cascading Style Sheets (Layout)
Web Development & Design Foundations with HTML5 7th Edition
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with HTML5
The Internet 10/25/11 XHTML Tables
Cascading Style Sheets
COMP 101 Review.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheet List Properties Box Properties Pseudoclass
PAGE LAYOUT - 2.  The div tag equipped with CSS rules produces good looking pages.  With CSS, the div tag can easily be positioned anywhere on the page.
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
6 Layout.
Positioning.
MORE Cascading Style Sheets (The Positioning Model)
DynamicHTML Cascading Style Sheet Internet Technology.
List Properties Box Properties Pseudoclass
Block-level Elements A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as.
DynamicHTML Cascading Style Sheet Internet Technology.
Web Development & Design Foundations with HTML5
SEEM4570 Tutorial 3: CSS + CSS3.0
Floating and Positioning
Web Development & Design Foundations with HTML5
Positioning.
Session 4: CSS Positioning
The Internet 10/20/11 CSS Layout
CSc 337 Lecture 5: Grid layout.
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

CGS 3066: Web Programming and Design Fall 2019 CSS Extra Department of Computer Science, Florida State University

CSS Pseudo Classes A pseudo-class is used to define a special state of an element. for example: Style an element when a user mouses over it Style visited and unvisited links differently Style an element when it gets focus selector:pseudo-class { property:value; }

Pseudo Class for Anchor tag Links can be displayed in different ways: /* mouse over link */ a:hover { color: #FF00FF; } /* selected link */ a:active { color: #0000FF; /* unvisited link */ a:link { color: #FF0000; } /* visited link */ a:visited { color: #00FF00; Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective! a:active MUST come after a:hover in the CSS definition in order to be effective! Pseudo-class names are case-sensitive.

Combining Pseudo Classes with CSS Classes Pseudo-classes can be combined with CSS classes When you hover over the link that belongs to highlight class in this example, it will change color: a.highlight:hover { color: #ff0000; } You can find the complete list of Pseudo-Classes here.

HTML Block and Inline Elements Every HTML element has a default display value. The default display value for most elements is block or inline. A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). An inline element does not start on a new line and only takes up as much width as necessary.

HTML Block and Inline Elements Example Block Elements: <p> , <pre> , <table> , <ul> , <ol>, ... Example Inline Elements: <img> , <a> , <b> , <strong> , <small> , ...

<div> Element The <div> element is often used as a container for other HTML elements. The <div> element has no required attributes, but both style and class are common. When used together with CSS, the <div> element can be used to style blocks of content <div style="background-color:black;color:white;padding:20px;"> <h2>London</h2> <p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p> </div>

<span> Element The <span> element is often used as a container for some text. The <span> element has no required attributes, but both style and class are common. When used together with CSS, the <span> element can be used to style parts of the inline text <h1>My <span style="color:red">Important</span> Heading</h1>

Overriding Box Behavior We can override the default box type of HTML elements with the CSS display property. display property can have inline or block as its value. span, strong{ display: block; } <h2>Headings are block elements</h2> <p>Paragraphs are block as well</p> However, <span>Spans are not block</span>, similarly <strong>Strong is not a block element</strong> But we can override the box behavior.

More on Display properties Display: block/inline/inline-block “block” means the element should be displayed as a block element “inline” means the element should be displayed as a inline element “inline-block” Allows to set a width and height of the element Top and bottom margins/paddings are respected Does not add a line-break after the element, so the element can sit next to other elements.

Examples on Display properties .menu li{ list-style: none; display: inline-block; border: 1px solid blue; padding: 5px; width: 100px; text-align: center; } <ul class="menu"> <li>Home</li> <li>Courses</li> <li>Staff</li> <li>About Us</li> <li>Contact</li> </ul>

CSS Positioning Static/Relative/Absolute/Fixed/Sticky Static Positioning: Default positioning Static elements are positioned in the normal flow of the page In normal flow, inline boxes flow from left to right, wrapping to next line when needed. In normal flow, block boxes flow from top to bottom, making a new line after every box.

Static Positioning for Inline boxes

Static Positioning for Block boxes

Relative Positioning Takes the element out of the normal flow, allowing it to be moved to the top, left, right or bottom. Does not affect the elements surrounding it. Makes an element a "positioning context" in which to position other elements relative to it. Relative positioning and absolute positioning are used together.

Relative Positioning The "relative" value will still put the element in the normal flow, but then offset it according to top/left/right/bottom properties.

Absolute Positioning Positions element outside of the normal flow. An absolutely positioned element is offset from its container block, positioned relative. Its container block is the first element that has a position other than static. If no such element is found, the container block is <html>. Other elements act as if it's not there. Determined by its offset values in the properties top, bottom, right and left.

Absolute Positioning The "absolute" value will take the element out of the normal flow and position it in relation to the window (or the closest non-static element). Top Bottom

Absolute/Relative Positioning First, you must understand the normal flow of the web page Top to bottom. Left to right Absolute positioning means the position is relative to the first non-static ancestor of the element The position is relative to another element Relative positioning means the position is relative to its own static/normal position The position is relative to the position that the very same element would have in the normal flow

Z-Index Sometimes elements overlap. You can change the order of overlapping with z-index. The element with highest z-index goes on top. Top Bottom