>> More on CSS Selectors

Slides:



Advertisements
Similar presentations
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Advertisements

Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Part 2 Introduction to CSS. CSS Syntax – class selector 1 With the class selector you can define different styles for the same type of HTML element. You.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Advanced Techniques for Web Developers The Power of CSS Sandra Clark Senior Software Developer The Constella Group
Today’s objectives  Element relations – tree structure  Pseudo classes  Pseudo elements.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
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.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 9: Defining Selectors.
กระบวนวิชา 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.
Cascading style sheets CSS
Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 5: Cascading Style Sheets.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
Tutorial 4 Creating Special Effects with CSS
INTERNAL CSS Casey Ames Different types of CSS There are three different types of CSS: ◦ External CSS ◦ Internal CSS ◦ Inline CSS In this presentation.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
>> Introduction to HTML: Tables. HTML is used to give websites structure 5 Basic Tags Element = Start-Tag+Content+End-Tag Heading Tags [h1-h6] Paragraph.
Form Tag How to use Form Tag Something NEW ? PARAMETER Attribute NAME Specifies the name for a form To specify which form to submit with JavaScript, this.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Neal Stublen Course Road Map  Create web page layouts using CSS  Manage CSS  Test website validity  Create navigation menus using.
>> 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.
>> More on CSS Selectors. Pre-requisite Open the file called sample.txt Copy the all the text from the file Open your browser and go to codepen.io Paste.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Understanding ID and Class in CSS Web Design – Sec 4-9 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
IN THIS LESSON, WE WILL BECOME FAMILIAR WITH HTML AND BEGIN CREATING A WEB PAGE IN YOUR COMPUTER HTML – the foundation.
HTML + CSS II LET’S BUILD AN ACTUAL WEBSITE!. OVERVIEW This Session  Brief review of basics   “id” and “class”  Using a CSS template Upcoming Sessions.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Making web pages interactive with JavaScript.
IN THIS LESSON, WE WILL BECOME FAMILIAR WITH HTML AND BEGIN CREATING A WEB PAGE IN YOUR COMPUTER HTML – the foundation.
Tutorial 3 Designing a Web Page with CSS
CASCADING STYLE SHEET CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Introduction to CSS: Selectors
HTML & CSS Jan Janoušek.
>> JavaScript: Document Object Model
Week 2: Introduction to Design and CSS
>> Introduction to CSS
Cascading Style Sheets
>> The “Box” Model
>> CSS Rules Selection
Cascading Style Sheets
Intro to CSS CS 1150 Fall 2016.
>> CSS Layouts.
CSS Intro.
CASCADING STYLE SHEET CSS.
Intro to CSS CS 1150 Spring 2017.
The Web Wizard’s Guide To DHTML and CSS
Web Programming A different world! Three main languages/tools No Java
HTML A brief introduction HTML.
Intro to CSS Mr. Singh.
>> Dynamic CSS Selectors
Document Object Model (DOM): Objects and Collections
Cascading Style Sheets
HTML / CSS Mai Moustafa Senior Web Designer eSpace eSpace.
Inheritance CSS.
Web Client Side Technologies Raneem Qaddoura
Focusing Your CSS Selectors
CS332A Advanced HTML Programming
Presentation transcript:

>> More on CSS Selectors

Pre-requisite Download and open the file called selectors.html Open the file in the editor

Recall Types of Selectors Combining Selectors Element/Type Selector ID Selector (#) Class Selector (.) Combining Selectors Use a “,”

Web-based Systems | Misbhauddin Sample File DOM Tree HTML BODY <h2> <div id =“first-div”> <p class=“first”> <a> <a> <div id=“nested-div”> <p class=“first”> <p> <p> <p> Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Universal Selector Universal selector is used when you want to apply the style to all elements within the page. It does not have any weight USAGE: *  Try Now Select and color all elements Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Within Selector This is used to select selectors that are either within or beside each other No space between the name USAGE EXAMPLE: div.test Select the label element with class required and color it red. Try Now Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Descendant Selector Descendant means anywhere nested within it in the DOM tree Could be a direct child, could be five levels deep, it is still a descendant USAGE: white space between two selectors  Select and color all paragraph descendants of the div tag with id “first-div” Try Now Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Child Selector It means "select elements that are direct descendants only“ USAGE: > between two selectors Example: div > p  Select and color all paragraph children of the div tag with id “first-div” Try Now Web-based Systems | Misbhauddin

General Sibling Selector This selects elements at the same hierarchy level USAGE: ~ between two selectors Example: div ~ p  Select and color all paragraph siblings of the div tag with id “nested-div” Try Now Web-based Systems | Misbhauddin

Adjacent Sibling Selector This means is "select a tag that is directly after another given tag (with nothing in between)“ USAGE: + between two selectors Example: div + p  Select and color the paragraph sibling of the div tag with id “first-div” Try Now Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Attribute Selector This means is “select a tag when the attribute value is equal to the specified value“ Weight is equal to a class selector USAGE: tag[attribute=“value”] Example: input[type=“text”] [prop = value] Exactly equal to the value [prop *= value] Contains value somewhere [prop ^= value] Begins with value [prop $= value] Ends with value For the hyperlink element with the word “kfu” within the href attribute, set the color to green Try Now Web-based Systems | Misbhauddin

Next on Web-based Systems Dynamic Selectors in CSS Details on Selectors and Properties http://css-tricks.com/almanac/