SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
ShingalaKrupa
 

Mais procurados (20)

JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
Css Basics
Css BasicsCss Basics
Css Basics
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
Css floats
Css floatsCss floats
Css floats
 
CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations
 
Style and Selector
Style and SelectorStyle and Selector
Style and Selector
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
Js ppt
Js pptJs ppt
Js ppt
 
Basic html
Basic htmlBasic html
Basic html
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Html styles
Html stylesHtml styles
Html styles
 
Java script
Java scriptJava script
Java script
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Navigation and Link
Navigation and LinkNavigation and Link
Navigation and Link
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
 
Background property in css
Background property in cssBackground property in css
Background property in css
 
JavaScript and BOM events
JavaScript and BOM eventsJavaScript and BOM events
JavaScript and BOM events
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

On Display: A Practical Overview of the CSS Display Property