CS3220 Web and Internet Programming More CSS

Slides:



Advertisements
Similar presentations
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
Advertisements

1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
Session 4: CSS Positioning Fall 2006 LIS Web Team.
Client-Side Internet and Web Programming
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.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
กระบวนวิชา 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 normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
More CSS CS HTML id attribute 2 Coding Horror! Our mission is to combine programming and “human” factors with geekiness! output  A unique ID for.
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
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.
Tutorial 4 Creating Page Layouts with CSS
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
WebD Introduction to CSS By Manik Rastogi.
CSS.
Laying out Elements with CSS
Chapter 6 - Cascading Style Sheets™ (CSS)
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
CSS Layouts CH 13.
Table Styling.
Table Styling.
Semester - Review.
The Box Model in CSS Web Design – Sec 4-8
CSS Layouts: Grouping Elements
Applying CSS to Tables Stylish Tables.
Table Styling.
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
>> The “Box” Model
Cascading Style Sheets (Layout)
Web Systems & Technologies
CS3220 Web and Internet Programming Page Layout with CSS
The Internet 10/25/11 XHTML Tables
CSS Applications to XML 19-Sep-18.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Chapter 6 More CSS Basics Key Concepts
Objectives Create a reset style sheet Explore page layout designs
Cascading Style Sheets
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
The Internet 10/13/11 The Box Model
HTML5 Session III Chapter 5 - How to Use the CSS Box Model for Spacing, Borders, and Backgrounds Chapter 6 - How to use CSS for page.
CSS Borders and Margins.
HTML5 Level I Session III
HTML5 Level I Session III
Box model, spacing, borders, backgrounds
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
SEEM4570 Tutorial 3: CSS + CSS3.0
How to use the CSS box model for spacing, borders, and backgrounds
More CSS 22-Feb-19.
CS3220 Web and Internet Programming Page Layout with CSS
Principles of Web Design 5th Edition
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
The Internet 10/20/11 CSS Layout
CSS Applications to XML 20-May-19.
Web Client Side Technologies Raneem Qaddoura
CSc 337 Lecture 5: Grid layout.
CSS Applications to XML 3-Jul-19.
ITI 133: HTML5 Desktop and Mobile Level I
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
CS3220 Web and Internet Programming More CSS
Presentation transcript:

CS3220 Web and Internet Programming More CSS Chengyu Sun California State University, Los Angeles

More CSS Selectors Pseudo-class selectors Combined selectors

CSS Pseudo-Class … A CSS pseudo-class is a keyword preceded by a colon (:) that is added on to the end of selectors to specify that you want to style the selected elements only when they are in certain state

… CSS Pseudo-Class Some pseudo-classes :link, :visited, :hover, :active :first-of-type, :last-of-type :first-child, :last-child More at http://www.w3schools.com/css/css_pseudo_classes.asp

About Styling Links Follow the LVHA order For privacy reasons, only certain properties can be used to style :visited

Combine Selectors AB A B A > B A+B A ~ B Any element matching both A and B at the same time. A B Any element matching B that is a descendant of an element matching A. A > B Any element matching B that is a direct child of an element matching A. A+B Any element matching B that is the next sibling of an element matching A. A ~ B Any element matching B that is among the next siblings of an element matching A.

Combined Selector Examples ul.courses {…} #main li {…} table thead th {…} table tbody td + td {…} table tbody td:last-child {…}

The CSS Box Model … Each element is represented as a rectangular box that consists of several layers: content, padding, border, and margin.

… The CSS Box Model margin border padding Content height width

Border Properties border-width border-style border-color solid, dashed, dotted, double, and more border-color border [width] [style] [color]

border-<side> Properties <side> can be top, bottom, left, and right, e.g. border-top-width: 1px; border-bottom-color: red; border-left: 1px solid black;

Create Rounded Corner with border-radius Four corners can be controlled individually See more at http://www.w3schools.com/css/css3_borders.asp

About Table Borders The separated model (default) sets borders on individual cells table {border-collapse: separate;} Gap between cell borders; cannot set border on <tr> The collapsed model sets continuous borders from one end of the table to the other table {border-collapse: collapse;} No gap between cell borders; can set border on <tr>

About Width and Height Can use absolute (e.g. px) or relative (e.g. %) values Default value is auto min-width, max-width, min-height, max-height Need to set display property to inline-block in order to set width/height for inline elements

About Margin and Padding … Can use absolute (e.g. px) or relative (e.g. %) values Set margin to auto usually centers an element The four sides of margin/padding can be set individually or all at once top, bottom, right, left

… About Margin and Padding … Use of the margin and padding property margin/padding: <all>; margin/padding: <top_and_bottom> <left_and_right>; margin/padding: <top> <left_and_right> <bottom>; margin/padding: <top> <right> <bottom> <left>;

… About Margin and Padding Top and bottom margins of blocks are sometimes combined into a single margin whose size is the largest of the margins combined into it, i.e. margin collapsing

Background Properties … background-color background-image Property value is a URL to the image, e.g. url(“img/background.gif”) background-repeat repeat, repeat-x, repeat-y, no-repeat background-position left top, left center, left bottom, and so on

… Background Properties background-attachment scroll (default), fixed background [color] [image] [repeat] [attachment] [position]