SlideShare une entreprise Scribd logo
1  sur  24
An Introduction to CSS
 Selectors and Drupal
Understanding CSS selectors and
 how Drupal allows you to use
  them to style pages is a key
         Drupal skill
Audience Knowledge Quiz
How many…
 …know what CSS stands for

 …have “cut & pasted” CSS into sites

 …have written their own CSS rules from
  scratch

 …know what a CSS Selector is

 …are experts, just here to heckle
Why Should You Know This

Turn this:
Into this…
 with CSS
CSS Rule Syntax
Example:                         CSS Syntax:
CSS:                              <Selector> {
   A.menu:hover {
     color: #002b70;               <property>: <value>;
     text-decoration:   underline; <property>: <value>;
   }
                                   …
HTML:                             }
<UL>
  <LI>
     <A class=“menu” href=“foobar.html”>FooBar</A>
  </LI>
</UL>
What are Selectors
Patterns used to select the parts of a
document to apply the styles to.
The CSS3 spec define these patterns as:
  A chain of one or more sequence of simple
  selectors separated by combinators

Lets break this down…
Sequence of Simple Selectors
The most common simple selector types are:
 .<class>            select all elements with class=“<class>”
 <element>           match a specific HTML <element> (A, H2)
 #<id> match element with id=<id> attribute
 :<pseudo>           “pseudo class” selectors like :hover, :visited

These can be combined into sequences to target
specific document element like:
                               A.menu:hover
                               H1
                               #header
Note: There are a lot of other simple selectors, especially with CSS3. See:
                     http://www.w3.org/TR/css3-selectors/#selectors
What are Combinators
Combinators let you combine sequences of
simple selectors (S3) and target very specific
areas of a document.
Combinators are the most important CSS item
to understand with Drupal!
They let you target almost anything on a Drupal
page
Combinators
escendant – S3 S3…
Elements that are contained inside another
element. For example, the selector:


               IV.menu A:hover


ould define the hover style for any anchor tag
inside a div with class menu, even if there are
other tags between.
Combinators
hild – S3 > S3…
Describes elements that have a direct parent
and child relationship:

               L.menu > LI.leaf

ould target ONLY <LI class=“leaf”> elements
that were directly under a <UL class=“menu”>
element.

ibling – S3 + S3… or S3 ~ S3
Specificity (The Great Gotcha)
Complex CSS selectors will overlap with more
than one rule applying to an element.
Specificity defines how browsers should
calculate the “weight” of rules. The heavier ones
win.
Drupal tends to have LOTS of rules so chances
are your carefully crafted selector may not work.
Here’s how specificity is calculated:
       http://www.w3.org/TR/css3-selectors/#specificity
Something !Important
One trick to remember if your selector is not
specific enough is the !important property
declaration.
E.g., if these rules point to the same DIV, the text
color will be red (#id is highly specific).
Div#more_specific { color: red; }
Div.less_specific { color: green; }

If you add, !important to the properties, the color
will be green.
Div#more_specific { color: red; }
Div.less_specific { color: green !important; }
Drupal Areas
Drupal pages have a wide variety of CSS addressable
“areas” that are created by the system and themes.

•Page info
•Theme regions
•Nodes (Content type/Specific)
•Blocks (General / Specific )
•Menus (General / Specific )
•Views (General / Specific )
•Fields - Views & CCK (General / Specific )
•Form elements (General / Specific )
Page Info

 The body tag on Drupal pages will have
 several useful classes.

Front/Not-Front:           Front page or not
Logged-in/not-logged in:   User or Anonymous
Node-Type-<node-type>:     Class based on Node Type
Theme Regions
Theme Regions
Page Top:     <div id=“page-top” class=“region-page-top….
Header:       <div id=“header-group” class=“header-group…
Sidebar First: <div id=“sidebar-first” class=“region-sidebar-first…
Footer:       <div id=“footer” class=“region-footer…
Content:      <div id=“content” class=“region-content…

Example CSS
               #sidebar-first DIV.block {
                    padding-top: 15px;
               }
Nodes, Blocks, & Menus
Nodes, Blocks, & Menus
Node: <div id=“node-2” class=“node node-page full-node…
Block: <div id=“block-block-2” class=“block…
Menu: <div id=“block-system-main-menu”
             class=“block block-system block-menu…

Example CSS
   #block-block2 .content {
     background-image: url("../images/SkylarkingDef2.gif");
     background-repeat: no-repeat;
     width: 151px;
     height: 308px;;
   }
Views & View Fields
Views & View Fields

View: <div class=“view view-photo-galleries…

Field: <div class=“views-field views-field-title…


Example CSS
    .view-photo-galleries .views-field-title {
      padding-bottom: 6px;
    }
    .view-photo-galleries .views-field-title A {
      font-size: 18px;
    }
CCK Fields
CCK Fields
Field:        <div class=“field field-name-field-quest…
Field Label: <div class=“field-label…
Field Items: <div class=“field-items…
Field Item:   <div class=“field-item…

 Example CSS
     .node-field-example .field DIV.field-label {
       padding: 1em 0;
     }
     .node-field-example .field DIV.items {
       padding: 1em 0 2em 1em;
     }
Form Fields

No examples prepared, but
forms are similar to CCK /
Node fields.
Helpful Tools

FireFox with FireBug

Chrome with built in Explore Element
Questions?

This has covered a lot of complex
       concepts quickly….

Contenu connexe

Tendances

Tendances (20)

Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
Hl7 v2 messaging conformance jan 2011
Hl7 v2 messaging conformance jan 2011Hl7 v2 messaging conformance jan 2011
Hl7 v2 messaging conformance jan 2011
 
Resource Bundle
Resource BundleResource Bundle
Resource Bundle
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
SHACL Overview
SHACL OverviewSHACL Overview
SHACL Overview
 
SASS - CSS with Superpower
SASS - CSS with SuperpowerSASS - CSS with Superpower
SASS - CSS with Superpower
 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
 
Html projects for beginners
Html projects for beginnersHtml projects for beginners
Html projects for beginners
 
Doing Joins in MongoDB: Best Practices for Using $lookup
Doing Joins in MongoDB: Best Practices for Using $lookupDoing Joins in MongoDB: Best Practices for Using $lookup
Doing Joins in MongoDB: Best Practices for Using $lookup
 
Json
JsonJson
Json
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
XML - Introducción
XML - IntroducciónXML - Introducción
XML - Introducción
 
CSS Lists and Tables
CSS Lists and TablesCSS Lists and Tables
CSS Lists and Tables
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
CSS
CSSCSS
CSS
 
HTML5 în XXX de minute
HTML5 în XXX de minuteHTML5 în XXX de minute
HTML5 în XXX de minute
 
XML Avancé : DTD, XSD, XPATH, XSLT, XQuery
XML Avancé : DTD, XSD, XPATH, XSLT, XQueryXML Avancé : DTD, XSD, XPATH, XSLT, XQuery
XML Avancé : DTD, XSD, XPATH, XSLT, XQuery
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 

En vedette

Using Content Delivery Networks with Drupal
Using Content Delivery Networks with DrupalUsing Content Delivery Networks with Drupal
Using Content Delivery Networks with Drupalcgmonroe
 
Congress powerpoint (final)
Congress powerpoint (final)Congress powerpoint (final)
Congress powerpoint (final)shaw swafford
 
Powers of 10
Powers of 10Powers of 10
Powers of 10Earl Cote
 
Eval 4 construction
Eval 4 constructionEval 4 construction
Eval 4 constructionhamsterlife
 
2009 Retail Development Seminar
2009 Retail Development Seminar2009 Retail Development Seminar
2009 Retail Development SeminarStephanie Lindley
 
Savior Skin Template
Savior Skin TemplateSavior Skin Template
Savior Skin TemplateMarcMooney
 
οι 3 φάκελοι
οι 3 φάκελοιοι 3 φάκελοι
οι 3 φάκελοιatanatsis
 
Getting to the Heart of the Matter: Communities and Health Systems Strengthening
Getting to the Heart of the Matter: Communities and Health Systems StrengtheningGetting to the Heart of the Matter: Communities and Health Systems Strengthening
Getting to the Heart of the Matter: Communities and Health Systems Strengtheningjehill3
 
Incidence of posterior capsular opacification in rigid pmma
Incidence of posterior capsular opacification in rigid pmmaIncidence of posterior capsular opacification in rigid pmma
Incidence of posterior capsular opacification in rigid pmmaDr. Anand Sudhalkar
 
Changing trends in ophthalmic practice 2
Changing trends in ophthalmic practice 2Changing trends in ophthalmic practice 2
Changing trends in ophthalmic practice 2Dr. Anand Sudhalkar
 
Partnership Defined Quality: Acting it Out!
Partnership Defined Quality: Acting it Out!Partnership Defined Quality: Acting it Out!
Partnership Defined Quality: Acting it Out!jehill3
 
Laerdal: Helping Save Lives
Laerdal: Helping Save LivesLaerdal: Helping Save Lives
Laerdal: Helping Save Livesjehill3
 
Community Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB ProjectCommunity Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB Projectjehill3
 
Space Camp Barcelona 2010 - English
Space Camp Barcelona 2010 - EnglishSpace Camp Barcelona 2010 - English
Space Camp Barcelona 2010 - EnglishXavier Alabart
 
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...jehill3
 
Polynomials
PolynomialsPolynomials
Polynomialsnina
 
European Financial News Distribution Bmb 2010
European Financial News Distribution Bmb 2010European Financial News Distribution Bmb 2010
European Financial News Distribution Bmb 2010Brazil Means Business
 

En vedette (20)

Using Content Delivery Networks with Drupal
Using Content Delivery Networks with DrupalUsing Content Delivery Networks with Drupal
Using Content Delivery Networks with Drupal
 
Congress powerpoint (final)
Congress powerpoint (final)Congress powerpoint (final)
Congress powerpoint (final)
 
European Venture Market
European Venture MarketEuropean Venture Market
European Venture Market
 
Powers of 10
Powers of 10Powers of 10
Powers of 10
 
Eval 4 construction
Eval 4 constructionEval 4 construction
Eval 4 construction
 
2009 Retail Development Seminar
2009 Retail Development Seminar2009 Retail Development Seminar
2009 Retail Development Seminar
 
Savior Skin Template
Savior Skin TemplateSavior Skin Template
Savior Skin Template
 
οι 3 φάκελοι
οι 3 φάκελοιοι 3 φάκελοι
οι 3 φάκελοι
 
Getting to the Heart of the Matter: Communities and Health Systems Strengthening
Getting to the Heart of the Matter: Communities and Health Systems StrengtheningGetting to the Heart of the Matter: Communities and Health Systems Strengthening
Getting to the Heart of the Matter: Communities and Health Systems Strengthening
 
Incidence of posterior capsular opacification in rigid pmma
Incidence of posterior capsular opacification in rigid pmmaIncidence of posterior capsular opacification in rigid pmma
Incidence of posterior capsular opacification in rigid pmma
 
Dinnershow of Dreams
Dinnershow of DreamsDinnershow of Dreams
Dinnershow of Dreams
 
Changing trends in ophthalmic practice 2
Changing trends in ophthalmic practice 2Changing trends in ophthalmic practice 2
Changing trends in ophthalmic practice 2
 
Partnership Defined Quality: Acting it Out!
Partnership Defined Quality: Acting it Out!Partnership Defined Quality: Acting it Out!
Partnership Defined Quality: Acting it Out!
 
Laerdal: Helping Save Lives
Laerdal: Helping Save LivesLaerdal: Helping Save Lives
Laerdal: Helping Save Lives
 
Community Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB ProjectCommunity Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB Project
 
Space Camp Barcelona 2010 - English
Space Camp Barcelona 2010 - EnglishSpace Camp Barcelona 2010 - English
Space Camp Barcelona 2010 - English
 
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...
Lives Saved Analyses for Child Survival Projects: Basic How-To Use LiST - Deb...
 
Polynomials
PolynomialsPolynomials
Polynomials
 
Crm
CrmCrm
Crm
 
European Financial News Distribution Bmb 2010
European Financial News Distribution Bmb 2010European Financial News Distribution Bmb 2010
European Financial News Distribution Bmb 2010
 

Similaire à Intro to CSS Selectors in Drupal

Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS MethodologyZohar Arad
 
SMACSS Your Sass Up
SMACSS Your Sass UpSMACSS Your Sass Up
SMACSS Your Sass UpMina Markham
 
Css for Development
Css for DevelopmentCss for Development
Css for Developmenttsengsite
 
3 css essentials
3 css essentials3 css essentials
3 css essentialsAnchu S
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting LabSwapnali Pawar
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.pptdatapro2
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.pptmohamed abd elrazek
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.pptscet315
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Likitha47
 
SharePointfest Denver - A jQuery Primer for SharePoint
SharePointfest Denver -  A jQuery Primer for SharePointSharePointfest Denver -  A jQuery Primer for SharePoint
SharePointfest Denver - A jQuery Primer for SharePointMarc D Anderson
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LAJake Johnson
 
CSS101 - Concept Fundamentals for non UI Developers
CSS101 - Concept Fundamentals for non UI DevelopersCSS101 - Concept Fundamentals for non UI Developers
CSS101 - Concept Fundamentals for non UI DevelopersDarren Gideon
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxGmachImen
 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layoutCK Yang
 

Similaire à Intro to CSS Selectors in Drupal (20)

Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
 
SMACSS Workshop
SMACSS WorkshopSMACSS Workshop
SMACSS Workshop
 
SMACSS Your Sass Up
SMACSS Your Sass UpSMACSS Your Sass Up
SMACSS Your Sass Up
 
Css for Development
Css for DevelopmentCss for Development
Css for Development
 
3 css essentials
3 css essentials3 css essentials
3 css essentials
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
SharePointfest Denver - A jQuery Primer for SharePoint
SharePointfest Denver -  A jQuery Primer for SharePointSharePointfest Denver -  A jQuery Primer for SharePoint
SharePointfest Denver - A jQuery Primer for SharePoint
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LA
 
Fewd week2 slides
Fewd week2 slidesFewd week2 slides
Fewd week2 slides
 
Lecture2
Lecture2Lecture2
Lecture2
 
CSS101 - Concept Fundamentals for non UI Developers
CSS101 - Concept Fundamentals for non UI DevelopersCSS101 - Concept Fundamentals for non UI Developers
CSS101 - Concept Fundamentals for non UI Developers
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layout
 
Creative Web 2 - CSS
Creative Web 2 - CSS Creative Web 2 - CSS
Creative Web 2 - CSS
 

Plus de cgmonroe

Structured SEO Data Overview and How To
Structured SEO Data Overview and How ToStructured SEO Data Overview and How To
Structured SEO Data Overview and How Tocgmonroe
 
Structured SEO Data: An overview and how to for Drupal
Structured SEO Data:  An overview and how to for DrupalStructured SEO Data:  An overview and how to for Drupal
Structured SEO Data: An overview and how to for Drupalcgmonroe
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)cgmonroe
 
Tips on Securing Drupal Sites
Tips on Securing Drupal SitesTips on Securing Drupal Sites
Tips on Securing Drupal Sitescgmonroe
 
Becoming "Facet"-nated with Search API
Becoming "Facet"-nated with Search APIBecoming "Facet"-nated with Search API
Becoming "Facet"-nated with Search APIcgmonroe
 
Intro to drupal module internals asheville
Intro to drupal module internals ashevilleIntro to drupal module internals asheville
Intro to drupal module internals ashevillecgmonroe
 
Solr facets and custom indices
Solr facets and custom indicesSolr facets and custom indices
Solr facets and custom indicescgmonroe
 
HTML Purifier, WYSIWYG, and TinyMCE
HTML Purifier, WYSIWYG, and TinyMCEHTML Purifier, WYSIWYG, and TinyMCE
HTML Purifier, WYSIWYG, and TinyMCEcgmonroe
 
Using the Features API
Using the Features APIUsing the Features API
Using the Features APIcgmonroe
 
The Drupal Strongarm Module - Tips and Tricks.
The Drupal Strongarm Module - Tips and Tricks.The Drupal Strongarm Module - Tips and Tricks.
The Drupal Strongarm Module - Tips and Tricks.cgmonroe
 
Drupal Workflow Concepts
Drupal Workflow ConceptsDrupal Workflow Concepts
Drupal Workflow Conceptscgmonroe
 
TriDUG WebFM Presentation
TriDUG WebFM PresentationTriDUG WebFM Presentation
TriDUG WebFM Presentationcgmonroe
 

Plus de cgmonroe (12)

Structured SEO Data Overview and How To
Structured SEO Data Overview and How ToStructured SEO Data Overview and How To
Structured SEO Data Overview and How To
 
Structured SEO Data: An overview and how to for Drupal
Structured SEO Data:  An overview and how to for DrupalStructured SEO Data:  An overview and how to for Drupal
Structured SEO Data: An overview and how to for Drupal
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
 
Tips on Securing Drupal Sites
Tips on Securing Drupal SitesTips on Securing Drupal Sites
Tips on Securing Drupal Sites
 
Becoming "Facet"-nated with Search API
Becoming "Facet"-nated with Search APIBecoming "Facet"-nated with Search API
Becoming "Facet"-nated with Search API
 
Intro to drupal module internals asheville
Intro to drupal module internals ashevilleIntro to drupal module internals asheville
Intro to drupal module internals asheville
 
Solr facets and custom indices
Solr facets and custom indicesSolr facets and custom indices
Solr facets and custom indices
 
HTML Purifier, WYSIWYG, and TinyMCE
HTML Purifier, WYSIWYG, and TinyMCEHTML Purifier, WYSIWYG, and TinyMCE
HTML Purifier, WYSIWYG, and TinyMCE
 
Using the Features API
Using the Features APIUsing the Features API
Using the Features API
 
The Drupal Strongarm Module - Tips and Tricks.
The Drupal Strongarm Module - Tips and Tricks.The Drupal Strongarm Module - Tips and Tricks.
The Drupal Strongarm Module - Tips and Tricks.
 
Drupal Workflow Concepts
Drupal Workflow ConceptsDrupal Workflow Concepts
Drupal Workflow Concepts
 
TriDUG WebFM Presentation
TriDUG WebFM PresentationTriDUG WebFM Presentation
TriDUG WebFM Presentation
 

Dernier

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Dernier (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Intro to CSS Selectors in Drupal

  • 1. An Introduction to CSS Selectors and Drupal Understanding CSS selectors and how Drupal allows you to use them to style pages is a key Drupal skill
  • 2. Audience Knowledge Quiz How many… …know what CSS stands for …have “cut & pasted” CSS into sites …have written their own CSS rules from scratch …know what a CSS Selector is …are experts, just here to heckle
  • 3. Why Should You Know This Turn this: Into this… with CSS
  • 4. CSS Rule Syntax Example: CSS Syntax: CSS: <Selector> { A.menu:hover { color: #002b70; <property>: <value>; text-decoration: underline; <property>: <value>; } … HTML: } <UL> <LI> <A class=“menu” href=“foobar.html”>FooBar</A> </LI> </UL>
  • 5. What are Selectors Patterns used to select the parts of a document to apply the styles to. The CSS3 spec define these patterns as: A chain of one or more sequence of simple selectors separated by combinators Lets break this down…
  • 6. Sequence of Simple Selectors The most common simple selector types are: .<class> select all elements with class=“<class>” <element> match a specific HTML <element> (A, H2) #<id> match element with id=<id> attribute :<pseudo> “pseudo class” selectors like :hover, :visited These can be combined into sequences to target specific document element like: A.menu:hover H1 #header Note: There are a lot of other simple selectors, especially with CSS3. See: http://www.w3.org/TR/css3-selectors/#selectors
  • 7. What are Combinators Combinators let you combine sequences of simple selectors (S3) and target very specific areas of a document. Combinators are the most important CSS item to understand with Drupal! They let you target almost anything on a Drupal page
  • 8. Combinators escendant – S3 S3… Elements that are contained inside another element. For example, the selector: IV.menu A:hover ould define the hover style for any anchor tag inside a div with class menu, even if there are other tags between.
  • 9. Combinators hild – S3 > S3… Describes elements that have a direct parent and child relationship: L.menu > LI.leaf ould target ONLY <LI class=“leaf”> elements that were directly under a <UL class=“menu”> element. ibling – S3 + S3… or S3 ~ S3
  • 10. Specificity (The Great Gotcha) Complex CSS selectors will overlap with more than one rule applying to an element. Specificity defines how browsers should calculate the “weight” of rules. The heavier ones win. Drupal tends to have LOTS of rules so chances are your carefully crafted selector may not work. Here’s how specificity is calculated: http://www.w3.org/TR/css3-selectors/#specificity
  • 11. Something !Important One trick to remember if your selector is not specific enough is the !important property declaration. E.g., if these rules point to the same DIV, the text color will be red (#id is highly specific). Div#more_specific { color: red; } Div.less_specific { color: green; } If you add, !important to the properties, the color will be green. Div#more_specific { color: red; } Div.less_specific { color: green !important; }
  • 12. Drupal Areas Drupal pages have a wide variety of CSS addressable “areas” that are created by the system and themes. •Page info •Theme regions •Nodes (Content type/Specific) •Blocks (General / Specific ) •Menus (General / Specific ) •Views (General / Specific ) •Fields - Views & CCK (General / Specific ) •Form elements (General / Specific )
  • 13. Page Info The body tag on Drupal pages will have several useful classes. Front/Not-Front: Front page or not Logged-in/not-logged in: User or Anonymous Node-Type-<node-type>: Class based on Node Type
  • 15. Theme Regions Page Top: <div id=“page-top” class=“region-page-top…. Header: <div id=“header-group” class=“header-group… Sidebar First: <div id=“sidebar-first” class=“region-sidebar-first… Footer: <div id=“footer” class=“region-footer… Content: <div id=“content” class=“region-content… Example CSS #sidebar-first DIV.block { padding-top: 15px; }
  • 17. Nodes, Blocks, & Menus Node: <div id=“node-2” class=“node node-page full-node… Block: <div id=“block-block-2” class=“block… Menu: <div id=“block-system-main-menu” class=“block block-system block-menu… Example CSS #block-block2 .content { background-image: url("../images/SkylarkingDef2.gif"); background-repeat: no-repeat; width: 151px; height: 308px;; }
  • 18. Views & View Fields
  • 19. Views & View Fields View: <div class=“view view-photo-galleries… Field: <div class=“views-field views-field-title… Example CSS .view-photo-galleries .views-field-title { padding-bottom: 6px; } .view-photo-galleries .views-field-title A { font-size: 18px; }
  • 21. CCK Fields Field: <div class=“field field-name-field-quest… Field Label: <div class=“field-label… Field Items: <div class=“field-items… Field Item: <div class=“field-item… Example CSS .node-field-example .field DIV.field-label { padding: 1em 0; } .node-field-example .field DIV.items { padding: 1em 0 2em 1em; }
  • 22. Form Fields No examples prepared, but forms are similar to CCK / Node fields.
  • 23. Helpful Tools FireFox with FireBug Chrome with built in Explore Element
  • 24. Questions? This has covered a lot of complex concepts quickly….