SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
How I Learned to Stop
Worrying and Love the
inline-block
by Robert Szaloki
Create a carousel
The carousel
<section>
</section>
List of items
<section>
<ol></ol>
</section>
Navigation
<section>
<ol></ol>
<button>&lang;</button>
<button>&rang;</button>
</section>
The code
<!DOCTYPE html>
<html lang="en-us">
<head>...</head>
<body>
<section data-component="carousel">
<button data-carousel-nav="prev">&lang;</button>
<button data-carousel-nav="next">&rang;</button>
<ol>
<li></li>
<li></li>
<li></li>
…
</ol>
</section>
<hr>
…
The code
<!DOCTYPE html>
<html lang="en-us">
<head>...</head>
<body>
<section data-component="carousel">
<button data-carousel-nav="prev">&lang;</button>
<button data-carousel-nav="next">&rang;</button>
<ol>
<li></li>
<li></li>
<li></li>
…
</ol>
</section>
<hr>
…
position:relative
position:absolute;
top:0;
bottom:0;
height:40px;
margin:auto 0;
width:40px;
…
margin:0 40px;
Dimensions
expand
40px 40pxexpand
40pxautoauto
bottom:0;
top:0;
Carousel item
<li>
<strong>....</strong>
<img>
<button>...</button>
<p>...</p>
</li>
Carousel item
<li>
<strong>....</strong>
<img>
<button>...</button>
<p>...</p>
</li> display:block
display:inline;
max-width:100%
float:left;
width:100%
display:inline-block;
vertical-align:baseline;
text-align:center;
white-space:normal;
box-sizing:border-box;
width:25%;
padding:0 10px;
Almost...
<!DOCTYPE html>
<html lang="en-us">
<head>...</head>
<body>
<section data-component="carousel">
<button data-carousel-nav="prev">&lang;</button>
<button data-carousel-nav="next">&rang;</button>
<ol>
<li></li>
<li></li>
<li></li>
…
</ol>
</section>
<hr>
…
margin:0 40px;
white-space:nowrap;
overflow:hidden;
transition:all 0.3s ease-in-out;
How will it move?
<ol> width
text-indent:-[<ol> width]px
DEMO!
https://c9.io/rszaloki_1/carousel/workspace/index.html
Debug mode
But why?
● the <li> elements are now inline
elements, so they create a line box
Line box? Line of text!
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Aenean ac gravida sapien. Nullam
tristique congue pharetra. Nullam fringilla pulvinar
ipsum in adipiscing. Donec porttitor justo tortor. Sed
risus ipsum, porta ac dui vitae, faucibus bibendum
purus. Integer congue scelerisque tristique.
Line boxes
<div>
Lorem ipsum dolor sit amet,
<b>consectetur adipiscing elit. Aenean ac</b>
gravida sapien. Nullam tristique congue pharetra.
<i>Nullam fringilla pulvinar ipsum in adipiscing.</i>
Donec porttitor justo tortor. Sed risus ipsum, porta ac dui
vitae, faucibus bibendum purus. Integer congue
scelerisque tristique.
</div>
Height of a line box
inline-block
<img>
Text
the tallest in the line
or the line-height
value
vertical-align:top;
But why?
● the <li> elements are now inline
elements, so they create a line box
● vertical-align:baseline means, the
elements in a line box should align with
the parents baseline
vertical-align
● baseline: align to the parents baseline
● top: top of the line
● middle: Aligns the middle of the element with the
middle of lowercase letters in the parent. (???)
● <value>
● <percentage>
“The baseline of an 'inline-block' is the
baseline of its last line box in the normal
flow”
But why?
● the <li> elements are now inline
elements, so they create a line box
● vertical-align:baseline means, the
elements in a line box should align with
the parents baseline
● since the <p> is not in the rendering flow
(because it’s floating) the current baseline
is the baseline of the button’s text.
● only the inline blocks are in the parent, so
they will align nicely
Uhm, wait!
MIND THE GAP
<ol>n
t <li>...</li>n
t <li>...</li>n
t <li>...</li>n
</ol>
I see white spaces!
MIND THE GAP
white spaces
HTML is data
● you are not programming in HTML
● it’s not a poem, it’s a structured, linked,
semantic data
● don’t add white spaces, just for formatting
● the DOM is your target, not the View
Source
“Uglify”
<ol>
<li>...</li>
<li>...</li>
<li>...</li>
</ol>
<ol>
<li>...
</li><li>...
</li><li>...
</li>
</ol>
Add interaction - Javascript
Let’s see the code!
Add interaction - Javascript
● use event delegation
● use Event.currentTarget and Event.target
● use jQuery, but you don’t need jQuery
plugins
● define behaviours
THANK YOU!
Questions?
http://c9.io/rszaloki_1/carousel
contact: robert.szaloki@euedge.com

Contenu connexe

En vedette

Node webkit-meetup
Node webkit-meetupNode webkit-meetup
Node webkit-meetupEU Edge
 
Synchronization with CouchDB and PouchDB
Synchronization with CouchDB and PouchDBSynchronization with CouchDB and PouchDB
Synchronization with CouchDB and PouchDBEU Edge
 
Frontend meetup 2014.06.25
Frontend meetup 2014.06.25Frontend meetup 2014.06.25
Frontend meetup 2014.06.25EU Edge
 
Res tful services
Res tful servicesRes tful services
Res tful servicesEU Edge
 
Budapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkitBudapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkitRobert Szaloki
 
Advanced python
Advanced pythonAdvanced python
Advanced pythonEU Edge
 
Halado css eu edge
Halado css   eu edgeHalado css   eu edge
Halado css eu edgeEU Edge
 
Mozilla Shumway - opensource meetup budapest
Mozilla Shumway - opensource meetup budapestMozilla Shumway - opensource meetup budapest
Mozilla Shumway - opensource meetup budapestRobert Szaloki
 
How I learned to Stop Worrying and Love the inline-block
How I learned to Stop Worrying and Love the inline-blockHow I learned to Stop Worrying and Love the inline-block
How I learned to Stop Worrying and Love the inline-blockEU Edge
 
Miért jó oktatóanyagot készíteni?
Miért jó oktatóanyagot készíteni?Miért jó oktatóanyagot készíteni?
Miért jó oktatóanyagot készíteni?EU Edge
 
Budapest New Tech Meetup - WebRTC
Budapest New Tech Meetup - WebRTCBudapest New Tech Meetup - WebRTC
Budapest New Tech Meetup - WebRTCRobert Szaloki
 
How does it work the keyboard
How does it work   the keyboardHow does it work   the keyboard
How does it work the keyboardEU Edge
 
Google glass a developers perspective
Google glass   a developers perspectiveGoogle glass   a developers perspective
Google glass a developers perspectiveEU Edge
 
Google glass ict day presentation
Google glass   ict day presentationGoogle glass   ict day presentation
Google glass ict day presentationEU Edge
 
What is python
What is pythonWhat is python
What is pythonEU Edge
 
Python alapu mobil backend
Python alapu mobil backendPython alapu mobil backend
Python alapu mobil backendEU Edge
 
Eu edge intro
Eu edge introEu edge intro
Eu edge introEU Edge
 

En vedette (20)

Open gl
Open glOpen gl
Open gl
 
Node webkit-meetup
Node webkit-meetupNode webkit-meetup
Node webkit-meetup
 
WebGL
WebGLWebGL
WebGL
 
Synchronization with CouchDB and PouchDB
Synchronization with CouchDB and PouchDBSynchronization with CouchDB and PouchDB
Synchronization with CouchDB and PouchDB
 
Frontend meetup 2014.06.25
Frontend meetup 2014.06.25Frontend meetup 2014.06.25
Frontend meetup 2014.06.25
 
Res tful services
Res tful servicesRes tful services
Res tful services
 
Budapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkitBudapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkit
 
Advanced python
Advanced pythonAdvanced python
Advanced python
 
Halado css eu edge
Halado css   eu edgeHalado css   eu edge
Halado css eu edge
 
Mozilla Shumway - opensource meetup budapest
Mozilla Shumway - opensource meetup budapestMozilla Shumway - opensource meetup budapest
Mozilla Shumway - opensource meetup budapest
 
Node.js
Node.jsNode.js
Node.js
 
How I learned to Stop Worrying and Love the inline-block
How I learned to Stop Worrying and Love the inline-blockHow I learned to Stop Worrying and Love the inline-block
How I learned to Stop Worrying and Love the inline-block
 
Miért jó oktatóanyagot készíteni?
Miért jó oktatóanyagot készíteni?Miért jó oktatóanyagot készíteni?
Miért jó oktatóanyagot készíteni?
 
Budapest New Tech Meetup - WebRTC
Budapest New Tech Meetup - WebRTCBudapest New Tech Meetup - WebRTC
Budapest New Tech Meetup - WebRTC
 
How does it work the keyboard
How does it work   the keyboardHow does it work   the keyboard
How does it work the keyboard
 
Google glass a developers perspective
Google glass   a developers perspectiveGoogle glass   a developers perspective
Google glass a developers perspective
 
Google glass ict day presentation
Google glass   ict day presentationGoogle glass   ict day presentation
Google glass ict day presentation
 
What is python
What is pythonWhat is python
What is python
 
Python alapu mobil backend
Python alapu mobil backendPython alapu mobil backend
Python alapu mobil backend
 
Eu edge intro
Eu edge introEu edge intro
Eu edge intro
 

Similaire à Frontend meetup 2013 08-06

Similaire à Frontend meetup 2013 08-06 (20)

Unit 2 (it workshop)
Unit 2 (it workshop)Unit 2 (it workshop)
Unit 2 (it workshop)
 
2a web technology html basics 1
2a web technology html basics 12a web technology html basics 1
2a web technology html basics 1
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basics
 
Html and css
Html and cssHtml and css
Html and css
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
Html ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangaloreHtml ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangalore
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPoint
 
web technology practical file
web technology practical fileweb technology practical file
web technology practical file
 
Html
HtmlHtml
Html
 
What is HTML? How do we Write it? Check out this Quick Guide from Web Courses...
What is HTML? How do we Write it? Check out this Quick Guide from Web Courses...What is HTML? How do we Write it? Check out this Quick Guide from Web Courses...
What is HTML? How do we Write it? Check out this Quick Guide from Web Courses...
 
Computer application html
Computer application htmlComputer application html
Computer application html
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Header,nav,footer
Header,nav,footerHeader,nav,footer
Header,nav,footer
 
#3 HTML & CSS [know-how]
#3 HTML & CSS [know-how]#3 HTML & CSS [know-how]
#3 HTML & CSS [know-how]
 
Completion - App Coding - My Deadlines
Completion - App Coding - My DeadlinesCompletion - App Coding - My Deadlines
Completion - App Coding - My Deadlines
 
Html
HtmlHtml
Html
 

Dernier

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 

Dernier (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Frontend meetup 2013 08-06