SlideShare a Scribd company logo
ON DISPLAY:
A PRACTICAL OVERVIEW OF THE CSS DISPLAY PROPERTY
Apresentationby /SteveBlaurock @sblaurock
WHY DO WE USE THE DISPLAY PROPERTY?
1. To show and hide sets of elements.
2. To controlthe wayelements "sit"in relation to one another.
VALUES OF INTEREST
CSS1
none
inline
block
list-item
CSS2.1
inline-block
table
table-row
table-cell
CSS3
flex
grid
Experimental
run-in
DISPLAY: NONE (CSS1)
Visuallyremove an element(and its children) from the page.
Element will havenoeffect onpagelayout.
jQuery: $('#elementId').hide();
VISIBILITY: HIDDEN (CSS2.1)
Render an element(and its children) as invisible.
Pagelayout will beeffected byhiddenelement.
ViewDemonstration
DISPLAY: INLINE (CSS1)
<span>, <a>, <b>, <img> ...
Flow ó
DISPLAY: BLOCK (CSS1)
<h1>, <p>, <div> ...
Flow ↕
DISPLAY: INLINE-BLOCK (CSS2.1)
Follows naturalinline flow, butgives us characteristics of block
elements.
Flow ó
COMPARING WITH FLOAT
inline-blockelements render the same waythattextwould.
Adjustalignmentusingvertical-alignif needed.
Aa
ViewDemonstration
ISSUES: SPACE IN MARKUP
Havingspaces or newlines in your HTML markup willlead
to unwanted space between elements.
<ulclass="inline-block">
<li>ItemA</li>
<li>ItemB</li>
...
</ul>
ViewDemonstration
ISSUES: IE7 COMPATABILITY
IE7 onlyallows inline-blockon naturallyinline elements.
.inline-block{
...
/*IE7Fix*/
zoom:1;
*display:inline;
}
DISPLAY: TABLE-* (CSS2.1)
Allows for table characteristics to be applied through CSS.
Usefulfor verticalcentering.
<divstyle="display:table;">
<divstyle="display:table-row;">
<divstyle="display:table-cell;">
YES,THISISCONTENT.
</div>
</div>
</div>
OVERVIEW
+
-
float
Full browsersupport.
Parentcontainercollapse (requires "clearfixhack").
+
+
-
-
inline-block
No collapsingofparentcontainer.
Full browsersupport(ish).
Requires "hack" forIE7support.
Issue with whitespace in markup.
+
+
-
-
table
No collapsingofparentcontainer.
Allows forvertical centering.
No supportforIE7.
Extramarkup.
DISPLAY: FLEX (CSS3)
Thechildrenofa“box” canbeorderedeitherverticallyorhorizontally
withinaparent.
Flexboxallowsyoutocontrolwhathappenstoanyremainingspace.
Itispossibletonesttheseboxes,allowingforverycomplexlayouts.
Support:
Chrome(Full),Firefox(Partial),Safari(Prefixed),
Opera(Prefixed),IE10 (Partial,Prefixed),IE11 (Full)
IGNORED DISPLAY VALUES
run-in-Notsupported in Firefox or IE7.
grid-Onlysupported in IE 10+ prefixed?
list-item-Justuse reallists.
SOURCES
CSSTricks - Display
CSSTricks - Fighting theSpaceBetweenInlineBlock Elements
DesignShack -What's theDeal WithDisplay: Inline-Block
MDN- Display
Mozilla Web Development - Cross Browser Inline-Block
Quirksmode- Display
TOOLS
HakimEl Hattab / reveal.js
THANK YOU!
Twitter: /Github:@sblaurock sblaurock

More Related Content

What's hot

What's hot (20)

How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Ef code first
Ef code firstEf code first
Ef code first
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
Css tables
Css tablesCss tables
Css tables
 
Frontend Crash Course: HTML and CSS
Frontend Crash Course: HTML and CSSFrontend Crash Course: HTML and CSS
Frontend Crash Course: HTML and CSS
 
HTML CSS and Web Development
HTML CSS and Web DevelopmentHTML CSS and Web Development
HTML CSS and Web Development
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS
CSSCSS
CSS
 
What is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | EdurekaWhat is Dependency Injection in Spring Boot | Edureka
What is Dependency Injection in Spring Boot | Edureka
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 Canvas
 
Java script
Java scriptJava script
Java script
 
Html
HtmlHtml
Html
 
Css
CssCss
Css
 
Introduction to HTML+CSS+Javascript.pptx
Introduction to HTML+CSS+Javascript.pptxIntroduction to HTML+CSS+Javascript.pptx
Introduction to HTML+CSS+Javascript.pptx
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath New York Community Day in-person event
UiPath New York Community Day in-person eventUiPath New York Community Day in-person event
UiPath New York Community Day in-person event
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

On Display: A Practical Overview of the CSS Display Property