SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

Node webkit-meetup
Node webkit-meetupNode webkit-meetup
Node webkit-meetup
EU Edge
 
Frontend meetup 2014.06.25
Frontend meetup 2014.06.25Frontend meetup 2014.06.25
Frontend meetup 2014.06.25
EU Edge
 
Res tful services
Res tful servicesRes tful services
Res tful services
EU Edge
 
Budapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkitBudapest New Tech Meetup - node-webkit
Budapest New Tech Meetup - node-webkit
Robert Szaloki
 
Advanced python
Advanced pythonAdvanced python
Advanced python
EU Edge
 
Halado css eu edge
Halado css   eu edgeHalado css   eu edge
Halado css eu edge
EU Edge
 
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
EU 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 - WebRTC
Robert Szaloki
 
How does it work the keyboard
How does it work   the keyboardHow does it work   the keyboard
How does it work the keyboard
EU Edge
 
Google glass a developers perspective
Google glass   a developers perspectiveGoogle glass   a developers perspective
Google glass a developers perspective
EU Edge
 
Google glass ict day presentation
Google glass   ict day presentationGoogle glass   ict day presentation
Google glass ict day presentation
EU Edge
 
What is python
What is pythonWhat is python
What is python
EU Edge
 
Python alapu mobil backend
Python alapu mobil backendPython alapu mobil backend
Python alapu mobil backend
EU Edge
 
Eu edge intro
Eu edge introEu edge intro
Eu edge intro
EU Edge
 

Destacado (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
 

Similar a Frontend meetup 2013 08-06

Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
 
Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)Css 2c (2) (1) (1) (2)
Css 2c (2) (1) (1) (2)
gng542
 
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
Sahil Gandhi
 
web technology practical file
web technology practical fileweb technology practical file
web technology practical file
FreedomFox1
 
Completion - App Coding - My Deadlines
Completion - App Coding - My DeadlinesCompletion - App Coding - My Deadlines
Completion - App Coding - My Deadlines
Team_Conscientia
 

Similar a 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
 

Último

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
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
 
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
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
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
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
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
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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
 

Frontend meetup 2013 08-06