Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.

Slides:



Advertisements
Similar presentations
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Advertisements

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.
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.
Client-Side Internet and Web Programming
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
กระบวนวิชา 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.
CSS provides a way to stray away from the traditional methods of using tables to lay out pages. Success with this technique depends on understanding of.
آموزش طراحی وب سایت جلسه نهم – نکات تکمیلی سی اس اس تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک.
MORE Cascading Style Sheets (The Positioning Model)
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.
Svetlin Nakov Telerik Web Design Course html5course.telerik.com Manager Technical Training
Slide 1 of 83 Table Borders To specify table borders in CSS, use the border property. The example below specifies a black border for table, th, and td.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
1Computer Sciences Department. And use
Cascading Style Sheets CSS. CSS Positioning Normal Flow Top -> bottom | left -> right Arranged in the order they appear in the code make room for one.
Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with.
Tutorial 4 Creating Special Effects with CSS
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
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
+ Cascading Style Sheets Positioning for any XHTML container tag (selected by name, class or id)
CSS Font CSS font properties define the font family, boldness, size, and the style of a text. CSS Font Families Generic family Font familyDescription Serif.
 Website development process  CSS  Javascript.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
ALBERT WAVERING BOBBY SENG. Week 3: CSS  Quiz  Announcements/questions/etc  Homework.
CSS = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
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.
More CSS.
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.
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
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.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
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.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
MTA EXAM HTML5 Application Development Fundamentals.
CONTROLLING Page layout
Cascading Style Sheets CSS2 - a bit more advanced.
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.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
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.
Cascading Styles Sheets Positioning HTML elements.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
Webpage layout using CSS
Floating & Positioning
Advanced CSS BIS1523 – Lecture 20.
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
IS333: MULTI-TIER APPLICATION DEVELOPMENT
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)
Web Development & Design Foundations with HTML5
Web Development & Design Foundations with HTML5
Positioning.
The Internet 10/20/11 CSS Layout
Positioning Boxes Using CSS
Presentation transcript:

Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS

CSS Links & Link Colors: link, visited, hover, active W3Schools: CSS link colorsCSS link colors Links can be styled with any CSS property (e.g. color, font-family, background, etc.) In addition, links can be styled differently depending on what state they are in. The four links states are: a:link - a normal, unvisited link a:visited - a link the user has visited a:hover - a link when the user mouses over it a:active - a link the moment it is clicked In the CSS a:link {color:#FF0000;} /* unvisited link */ a:visited {color:#00FF00;} /* visited link */ a:hover {color:#FF00FF;} /* mouse over link */ a:active {color:#0000FF;} /* selected link */

CSS Links & Link Styles: Text Decoration W3Schools: CSS link stylesCSS link styles In the example below the link changes decoration depending on what state it is in. Lets go through some of the other common ways to style links: Text Decoration The text-decoration property is mostly used to remove underlines from links: In the CSS a:link {text-decoration:none;} a:visited {text-decoration:none;} a:hover {text-decoration:underline;} a:active {text-decoration:underline;}

CSS Links & Link Styles: Background Color W3Schools: CSS link stylesCSS link styles In the example below the link changes color depending on what state it is in. Lets go through some of the other common ways to style links: Background Color The background-color property specifies the background color for links: In the CSS a:link {background-color:#B2FF99;} a:visited {background-color:#FFFF85;} a:hover {background-color:#FF704D;} a:active {background-color:#FF704D;}

CSS Links: Multiple Link Styles W3Schools: CSS link stylesCSS link styles In the example below the link changes style depending on what state it is in. Lets go through some of the other common ways to style links: Background Color The background-color property specifies the background color for links: In the CSS a:link {color:red; background-color:orange; text-decorantion:none;} a:visited {color:teal; background-color:khaki; text-decorantion:none;} a:hover {color:yellow; background-color:firebrick; text-decorantion:underline; text-decorantion:overline;} a:active {color:white; background-color:red; text-decorantion:underline; text-decorantion:overline;}

Intermediate CSS: Group and Nesting Selectors W3Schools: grouping - nestinggrouping - nesting Grouping Selectors In style sheets there are often elements with the same style. In the CSS h1{color:green;} h2{color:green;} p{color:green;} To minimize the code, you can group selectors. Separate each selector with a comma. In the example below we have grouped the selectors from the code above: h1,h2,p{color:green;}

Intermediate CSS: Group and Nesting Selectors W3Schools: grouping - nestinggrouping - nesting Nesting Selectors It is possible to apply a style for a selector within a selector. In the example below, one style is specified for all p elements, one style is specified for all elements with class="marked", and a third style is specified only for p elements within elements with class="marked": In the CSS p{color:blue; text-align:center; }.marked{background-color:red; }.marked p{color:orange; /* Similar to p.marked but without having to separately add class to p tag*/ }

Intermediate CSS: Dimensions (Height and Width) W3Schools: DimensionDimension The CSS dimension properties allow you to control the height and width of an element. In the CSS img.normal{ height:auto; } img.big{ height:120px; } p.ex{ height:100px; width:100px; }

Intermediate CSS: Display W3Schools: DisplayDisplay CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line break before and after it. Examples of block elements: An inline element only takes up as much width as necessary, and does not force line breaks. Examples of inline elements:

Intermediate CSS: Display W3Schools: DisplayDisplay Changing How an Element is Displayed Changing an inline element to a block element, or vice versa, can be useful for making the page look a specific way, and still follow web standards. The following example displays list items (which are usually block) as inline elements: CSS li {display:inline;} HTML Google Yahoo Bing Excite

Intermediate CSS: Display W3Schools: DisplayDisplay Span The following example displays span elements (which are usually inline) as block elements: CSS span {display:block;} HTML Nirvana Record: MTV Unplugged Year: 1993 Radiohead Record: OK Computer Year: 1997

Intermediate CSS: Display W3Schools: DisplayDisplay Hiding an Element - display:none or visibility:hidden Hiding an element can be done by setting the display property to "none" or the visibility property to "hidden". However, notice that these two methods produce different results: visibility:hidden hides an element, but it will still take up the same space as before. The element will be hidden, but still affect the layout. exampleexample h1.hidden {visibility:hidden;} display:none hides an element, and it will not take up any space. The element will be hidden, and the page will be displayed as if the element is not there. exampleexample h1.hidden {display:none;}

Intermediate CSS: Positioning W3Schools: PositioningPositioning The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big. Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method. There are four different positioning methods: Static Positioning Fixed Positioning Relative Positioning Absolute Positioning

Intermediate CSS: Positioning W3Schools: PositioningPositioning Static Positioning HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left, and right properties.

Intermediate CSS: Positioning W3Schools: PositioningPositioning Fixed Positioning An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled exampleexample CSS p.pos_fixed{position:fixed; top:50px; right:5px; } Note: IE7 and IE8 support the fixed value only if a !DOCTYPE is specified. Fixed positioned elements are removed from the normal flow. The document and other elements behave like the fixed positioned element does not exist. Fixed positioned elements can overlap other elements

Intermediate CSS: Positioning W3Schools: PositioningPositioning Relative Positioning A relative positioned element is positioned relative to its normal position. exampleexample CSS h2.pos_left{ position:relative; left:-50px; /* Notice the minus sign*/ } h2.pos_right{ position:relative; left:50px; }

Intermediate CSS: Positioning W3Schools: PositioningPositioning Relative Positioning The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow. exampleexample CSS h2.pos_top{position:relative; top:-50px; } HTML This is a heading with no position This heading is moved upwards according to its normal position

Intermediate CSS: Positioning W3Schools: PositioningPositioning Absolute Positioning An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is exampleexample CSS h2{position:absolute; left:100px; top:150px; } HTML This is a heading with an absolute position With absolute positioning, an element can be placed anywhere… Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist. Absolutely positioned elements can overlap other elements.

Intermediate CSS: Positioning W3Schools: PositioningPositioning Overlapping Elements: z-index When elements are positioned outside the normal flow, they can overlap other elements. The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others). An element can have a positive or negative stack order. exampleexample CSS img{position:absolute; left:0px; top:0px; z-index:-1; } An element with greater stack order is always in front of an element with a lower stack order. If two positioned elements overlap, without a z-index specified, the element positioned last in the HTML code will be shown on top.

Intermediate CSS: Positioning W3Schools: PositioningPositioning All Positioning Properties PropertDescription bottomSets the bottom margin edge for a positioned box clipClips an absolutely positioned element cursorSpecifies the type of cursor to be displayed leftSets the left margin edge for a positioned box overflowSpecifies what happens if content overflows an element's box positionSpecifies the type of positioning for an element rightSets the right margin edge for a positioned box topSets the top margin edge for a positioned box z-indexSets the stack order of an element

Intermediate CSS: Float W3Schools: FloatingFloating With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected. There are two float properties: clear float

Intermediate CSS: Float CSS Tricks: All About Floats W3Schools: FloatingAll About FloatsFloating With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected. There are two float properties: float clear I WILL TALK ABOUT FLOATS IN MORE DETAIL TOMORROW BEFORE STARTING INTO DESIGN