SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Author: Huỳnh Công Hoan
Creating a CSS layout
from scratch
DESIGNVELOPER
1. Slice image from design file.
2. Sketch the structure of HTML documents.
3. Building layout with HTML.
4. Style layout with CSS.
5. Validate web page.
6. Add support for web page.
7. Optimize source code.
Agenda
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Sketch the structure of HTML documents
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Sketch the structure of HTML documents
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Building layout with HTML
* Selecting the correct HTML tag corresponding to
sections of of the structure.
* Some HTML5 tag for Web page layouts
 header: represents a group of introductory or
navigation aids
 nav: section of page that links to other pages or to parts
within the page.
 footer: represent a footer for the section it applies to
 section:represent a generic document or application
section.
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
 article: a section of page that consists of a composition that
forms independent part of a document, page or site.
 aside: a section of a page that consists of content that is
tangentially related to the content around the aside element,
and which could be separate form that content.
 hgroup: used to group a set of h1 – h6 elements when heading
has multiple levels
Building layout with HTML
For more details, you can reference: www.w3schools.com
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Style layout with CSS
* Create CSS reset
+ HTML5 Doctor Reset:
http://html5doctor.com/html-5-reset-stylesheet
+ Normalize Reset
http://necolas.github.io/normalize.css/3.0.0/normalize.css
+ Yahoo! (YUI 3) Reset CSS
http://yui.yahooapis.com/3.14.1/build/cssreset/cssreset-
min.css
+ Eric Mayer’s “Reset CSS” 2.0
http://www.cssreset.com/scripts/eric-meyer-reset-css/
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
* Create main style
Style layout with CSS
+ CSS Selector:
http://www.w3schools.com/cssref/css_selectors.asp
+ CSS Specificity
http://coding.smashingmagazine.com/2007/07/27/css
-specificity-things-you-should-know/
* Create a specific style for a particular browser version
 Use conditional comments to assign a stylesheet for
a particular browser version
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Ex:
<!–-[if gte IE9]>
<link rel=―stylesheet‖ type=―text/css‖ href=―css/ie.css‖ />
<![endif]-->
<!—[if lte IE6]>
<link rel=―stylesheet‖ type=―text/css‖ href=―css/ie6.css‖ />
<![endif]-->
Style layout with CSS
To specify a style for IE10, you can use
<!--[if !IE]><!--<script> if (/*@cc_on!@*/false) {
document.documentElement.className+=' ie10'; } </script>
<!--<![endif-->Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Validate web page
* Validate HTML: http://validator.w3.org
* Validate CSS: http://jigsaw.w3.org/css-validator
* Validate links: http://validator.w3.org/checklink
To easy and convenience, you can use web developer add-on
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Add support for site page
* Support compatible cross browser.
+ Browser hack
 Use asterisks mark
Ex: For IE 5.5 & IE 6
* html .test { position: absolute;}
For morder browser
.test { position: fixed; }
 Use backflash mark
Ex: .test {
height: 500px; // For IE 5.5
height: 400px; // For morder browser
}
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
 Use underscore mark
Add support for site page (cont)
Ex: .test {
position: fixed; /* For morden browser */
_position: absolute; /* For IE <= 6 */
}
For more details, you can reference: browserhacks.com
 Use selector don’t exist in old browser
Ex: #test { position: absolute;}
html > body #text { position: fixed;}
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
 -ms- : Microsoft Internet Explorer
 -moz- : Mozilla Firefox
Add support for site page (cont)
+ Add vendor prefix for CSS3 properties
Ex: .box_rotate {
-webkit-transform: rotate(-20deg); /* Chrome, Safari 3.1+*/
-moz-transform: rotate(-20deg); /* Firefox 3.5 - 15 */
-ms-transform: rotate(-20deg); /* IE 9 */
-o-transform: rotate(-20deg); /* Opera 10.50-12.00 */
transform: rotate(-20deg); /* Firefox16+,IE 10+,Opera 12.10+
}
 -webkit- : Google Chrome & Safari
 -o- : Opera
 -kthml- : Konqueror
For more details, you can reference: caniuse.com
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Add support for site page (cont)
+ Embed direct JavaScript into CSS
* Use JavaScript
Ex: h1#fixed {
position: absolute;
top: expression((d = document.compatMode ==
"CSS1Compat"?document.documentElement :
document.body)&&(eval(d.scrollTop)) );
}
+ Use JavaScript library
 To use HTML5 in older browsers, you could us HTML5.js
(http://html5shim.googlecode.com/svn/trunk/html5.js)
or html5shiv (https://code.google.com/p/html5shiv)
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
* Supports a variety of different devices
Add support for site page (cont)
 To use CSS3 properties in old browser, you can use PIE
(http://css3pie.com)
 To use media query in old browser, you can use css3-mediaqueries-
js (http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-
mediaqueries.js)
 To fix some common bugs in IE, you can use IE9.js
(https://github.com/mylovecompany/ie9-js)
 To support a variety of different devices, you can use CSS Media
Queries
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Add support for site page (cont)
Ex: @media screen {
body { width: 75%; } /* Support for screen */
}
@media print {
body {
padding: 1in;
border: 0.5pt solid #666; /* Support for printer*/
}
}
@page {
margin: 2.5cm; /* default for all page */
}
@page:left {
margin-left: 5cm; /* only for left-page */
} Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Add support for site page (cont)
* Supports a variety of screen sizes
 Similar, to support a variety of screen sizes, you can use CSS Media
Queries for different screen sizes
Ex:
@media screen and (max-width: 980px) {
#pagewrap {width:95%;}
}
@media screen and (max-width: 650px) {
#pagewrap {width:65%;}
}
@media screen and (max-width: 480px) {
#pagewrap {width:35%;}
} Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Optimize source code
1. Optimize images
* Always use Save for Web & Deveice when save an
image in Photoshop.
* Selecting the appropriate image format.
+ GIF (Graphics Interchange Format)
 Use LZW method to compress image.
 Support transparent, animation.
 Only support a maximum of 256 colors
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
+ JPG (Joint Photographic Experts Group)
Optimize source code (cont)
 Support 16.7 million color
 Support progressive image
+ PNG (Portable Network Graphics)
 Support 8-bit color (GIF) and also support 24-bit RGB (JPG)
 Support transparent image, but not support animation
 Don’t support in old browser
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Optimize source code (cont)
* Use Image Sprite technical
+ A collection of images put into a single image.
+ Reduce the number of server requests and save bandwidth.
+ Online tools:
 Spritepad (spritepad.wearekiss.com)
 Project Fondue (spritegen.website-performance.org)
 CSS Sprites Generator (csssprites.com)
* Use image compressor
 Dynamic Drive (tools.dynamicdrive.com)
 Web Resizer (webresizer.com)
 Kraken.io (kraken.io)Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
2. Optimize HTML
+ Remove unnecessary white spaces, line breaks, tabs,…
3. Optimize CSS
+ Filter unnecessary selector, CSS shorthand, sort properties,
compress colors,…
+ Tools:
 CSS Beautifier (http://www.codebeautifier.com)
 Clean CSS (http://cleancss.com)
 Robson CSS Compressor
(http://iceyboard.no-ip.org/projects/css_compressor)
Optimize source code (cont)
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Web tool
Editor: Sublime Text + plugins: emmet, autoprefix, browser
frefesh, fetch,…
Software: Texter, Browser Chooser, IE Tester
Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
Thank you everyone

Weitere ähnliche Inhalte

Ähnlich wie Creating a CSS layout from scratch

Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibilityjsmith92
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSZoe Gillenwater
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript IntroductionDesignveloper
 
Fecrash10:3:17 sd
Fecrash10:3:17 sdFecrash10:3:17 sd
Fecrash10:3:17 sdThinkful
 
Fecc cg-cb-11.14.17
Fecc cg-cb-11.14.17 Fecc cg-cb-11.14.17
Fecc cg-cb-11.14.17 Thinkful
 
Introduction to Foundation
Introduction to FoundationIntroduction to Foundation
Introduction to FoundationDesignveloper
 
Fecc 12517-sd
Fecc 12517-sdFecc 12517-sd
Fecc 12517-sdThinkful
 
5 single page application principles developers need to know
5 single page application principles developers need to know5 single page application principles developers need to know
5 single page application principles developers need to knowChris Love
 
Designing SharePoint 2010 for Business
Designing SharePoint 2010 for BusinessDesigning SharePoint 2010 for Business
Designing SharePoint 2010 for BusinessKanwal Khipple
 
Bootstrap Jump Start
Bootstrap Jump StartBootstrap Jump Start
Bootstrap Jump StartHaim Michael
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...SPTechCon
 
CSS Eye for the Programmer Guy
CSS Eye for the Programmer GuyCSS Eye for the Programmer Guy
CSS Eye for the Programmer GuyDennis Slade Jr.
 
Web site fundamentals
Web site fundamentalsWeb site fundamentals
Web site fundamentalsvinturella
 

Ähnlich wie Creating a CSS layout from scratch (20)

Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
Fecrash10:3:17 sd
Fecrash10:3:17 sdFecrash10:3:17 sd
Fecrash10:3:17 sd
 
Fecc cg-cb-11.14.17
Fecc cg-cb-11.14.17 Fecc cg-cb-11.14.17
Fecc cg-cb-11.14.17
 
Introduction to Foundation
Introduction to FoundationIntroduction to Foundation
Introduction to Foundation
 
Html5 & less css
Html5 & less cssHtml5 & less css
Html5 & less css
 
Fecc 12517-sd
Fecc 12517-sdFecc 12517-sd
Fecc 12517-sd
 
php
phpphp
php
 
5 single page application principles developers need to know
5 single page application principles developers need to know5 single page application principles developers need to know
5 single page application principles developers need to know
 
Designing SharePoint 2010 for Business
Designing SharePoint 2010 for BusinessDesigning SharePoint 2010 for Business
Designing SharePoint 2010 for Business
 
Bootstrap Jump Start
Bootstrap Jump StartBootstrap Jump Start
Bootstrap Jump Start
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
 
Basic html structure
Basic html structureBasic html structure
Basic html structure
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
CSS Eye for the Programmer Guy
CSS Eye for the Programmer GuyCSS Eye for the Programmer Guy
CSS Eye for the Programmer Guy
 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823
 
Web site fundamentals
Web site fundamentalsWeb site fundamentals
Web site fundamentals
 
Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS Framework
 
Web Site Planning
Web Site PlanningWeb Site Planning
Web Site Planning
 

Mehr von Designveloper

Let us take care of your brand image
Let us take care of your brand imageLet us take care of your brand image
Let us take care of your brand imageDesignveloper
 
5 java script frameworks to watch in 2017
5 java script frameworks to watch in 20175 java script frameworks to watch in 2017
5 java script frameworks to watch in 2017Designveloper
 
Happy international women's day!
Happy international women's day!Happy international women's day!
Happy international women's day!Designveloper
 
Typing racer game - a nice break from work
Typing racer game  - a nice break from workTyping racer game  - a nice break from work
Typing racer game - a nice break from workDesignveloper
 
Should we work remotely?
Should we work remotely?Should we work remotely?
Should we work remotely?Designveloper
 
Meet song nhi your virtual financial assistance
Meet song nhi   your virtual financial assistanceMeet song nhi   your virtual financial assistance
Meet song nhi your virtual financial assistanceDesignveloper
 
Why pair programming is a good idea
Why pair programming is a good idea Why pair programming is a good idea
Why pair programming is a good idea Designveloper
 
5 worst mistakes of diy websites
5 worst mistakes of diy websites5 worst mistakes of diy websites
5 worst mistakes of diy websitesDesignveloper
 
Basic glossary of web design terms for non designers (part 2)
Basic glossary of web design terms for non designers (part 2)Basic glossary of web design terms for non designers (part 2)
Basic glossary of web design terms for non designers (part 2)Designveloper
 
Single page web application development using meteor js
Single page web application development using meteor jsSingle page web application development using meteor js
Single page web application development using meteor jsDesignveloper
 
Multiplayer game with unity3 d and meteor
Multiplayer game with unity3 d and meteorMultiplayer game with unity3 d and meteor
Multiplayer game with unity3 d and meteorDesignveloper
 
Awesome free resources for learning javascript
Awesome free resources for learning javascriptAwesome free resources for learning javascript
Awesome free resources for learning javascriptDesignveloper
 
What is the best java script frameworks to learn?
What is the best java script frameworks to learn?What is the best java script frameworks to learn?
What is the best java script frameworks to learn?Designveloper
 
Travelling forms a young man
Travelling forms a young manTravelling forms a young man
Travelling forms a young manDesignveloper
 
5 compelling reasons your website should be responsive
5 compelling reasons your website should be responsive5 compelling reasons your website should be responsive
5 compelling reasons your website should be responsiveDesignveloper
 
Reactive programming with tracker
Reactive programming with trackerReactive programming with tracker
Reactive programming with trackerDesignveloper
 
Benefits of using single page websites
Benefits of using single page websitesBenefits of using single page websites
Benefits of using single page websitesDesignveloper
 
What is the best programming language for beginner?
What is the best programming language for beginner?What is the best programming language for beginner?
What is the best programming language for beginner?Designveloper
 
No sql injection in meteor.js application
No sql injection in meteor.js applicationNo sql injection in meteor.js application
No sql injection in meteor.js applicationDesignveloper
 
How to deploy and scale your meteor apps
How to deploy and scale your meteor appsHow to deploy and scale your meteor apps
How to deploy and scale your meteor appsDesignveloper
 

Mehr von Designveloper (20)

Let us take care of your brand image
Let us take care of your brand imageLet us take care of your brand image
Let us take care of your brand image
 
5 java script frameworks to watch in 2017
5 java script frameworks to watch in 20175 java script frameworks to watch in 2017
5 java script frameworks to watch in 2017
 
Happy international women's day!
Happy international women's day!Happy international women's day!
Happy international women's day!
 
Typing racer game - a nice break from work
Typing racer game  - a nice break from workTyping racer game  - a nice break from work
Typing racer game - a nice break from work
 
Should we work remotely?
Should we work remotely?Should we work remotely?
Should we work remotely?
 
Meet song nhi your virtual financial assistance
Meet song nhi   your virtual financial assistanceMeet song nhi   your virtual financial assistance
Meet song nhi your virtual financial assistance
 
Why pair programming is a good idea
Why pair programming is a good idea Why pair programming is a good idea
Why pair programming is a good idea
 
5 worst mistakes of diy websites
5 worst mistakes of diy websites5 worst mistakes of diy websites
5 worst mistakes of diy websites
 
Basic glossary of web design terms for non designers (part 2)
Basic glossary of web design terms for non designers (part 2)Basic glossary of web design terms for non designers (part 2)
Basic glossary of web design terms for non designers (part 2)
 
Single page web application development using meteor js
Single page web application development using meteor jsSingle page web application development using meteor js
Single page web application development using meteor js
 
Multiplayer game with unity3 d and meteor
Multiplayer game with unity3 d and meteorMultiplayer game with unity3 d and meteor
Multiplayer game with unity3 d and meteor
 
Awesome free resources for learning javascript
Awesome free resources for learning javascriptAwesome free resources for learning javascript
Awesome free resources for learning javascript
 
What is the best java script frameworks to learn?
What is the best java script frameworks to learn?What is the best java script frameworks to learn?
What is the best java script frameworks to learn?
 
Travelling forms a young man
Travelling forms a young manTravelling forms a young man
Travelling forms a young man
 
5 compelling reasons your website should be responsive
5 compelling reasons your website should be responsive5 compelling reasons your website should be responsive
5 compelling reasons your website should be responsive
 
Reactive programming with tracker
Reactive programming with trackerReactive programming with tracker
Reactive programming with tracker
 
Benefits of using single page websites
Benefits of using single page websitesBenefits of using single page websites
Benefits of using single page websites
 
What is the best programming language for beginner?
What is the best programming language for beginner?What is the best programming language for beginner?
What is the best programming language for beginner?
 
No sql injection in meteor.js application
No sql injection in meteor.js applicationNo sql injection in meteor.js application
No sql injection in meteor.js application
 
How to deploy and scale your meteor apps
How to deploy and scale your meteor appsHow to deploy and scale your meteor apps
How to deploy and scale your meteor apps
 

Kürzlich hochgeladen

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Creating a CSS layout from scratch

  • 1. Author: Huỳnh Công Hoan Creating a CSS layout from scratch DESIGNVELOPER
  • 2. 1. Slice image from design file. 2. Sketch the structure of HTML documents. 3. Building layout with HTML. 4. Style layout with CSS. 5. Validate web page. 6. Add support for web page. 7. Optimize source code. Agenda Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 3. Sketch the structure of HTML documents Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 4. Sketch the structure of HTML documents Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 5. Building layout with HTML * Selecting the correct HTML tag corresponding to sections of of the structure. * Some HTML5 tag for Web page layouts  header: represents a group of introductory or navigation aids  nav: section of page that links to other pages or to parts within the page.  footer: represent a footer for the section it applies to  section:represent a generic document or application section. Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 6.  article: a section of page that consists of a composition that forms independent part of a document, page or site.  aside: a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be separate form that content.  hgroup: used to group a set of h1 – h6 elements when heading has multiple levels Building layout with HTML For more details, you can reference: www.w3schools.com Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 7. Style layout with CSS * Create CSS reset + HTML5 Doctor Reset: http://html5doctor.com/html-5-reset-stylesheet + Normalize Reset http://necolas.github.io/normalize.css/3.0.0/normalize.css + Yahoo! (YUI 3) Reset CSS http://yui.yahooapis.com/3.14.1/build/cssreset/cssreset- min.css + Eric Mayer’s “Reset CSS” 2.0 http://www.cssreset.com/scripts/eric-meyer-reset-css/ Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 8. * Create main style Style layout with CSS + CSS Selector: http://www.w3schools.com/cssref/css_selectors.asp + CSS Specificity http://coding.smashingmagazine.com/2007/07/27/css -specificity-things-you-should-know/ * Create a specific style for a particular browser version  Use conditional comments to assign a stylesheet for a particular browser version Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 9. Ex: <!–-[if gte IE9]> <link rel=―stylesheet‖ type=―text/css‖ href=―css/ie.css‖ /> <![endif]--> <!—[if lte IE6]> <link rel=―stylesheet‖ type=―text/css‖ href=―css/ie6.css‖ /> <![endif]--> Style layout with CSS To specify a style for IE10, you can use <!--[if !IE]><!--<script> if (/*@cc_on!@*/false) { document.documentElement.className+=' ie10'; } </script> <!--<![endif-->Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 10. Validate web page * Validate HTML: http://validator.w3.org * Validate CSS: http://jigsaw.w3.org/css-validator * Validate links: http://validator.w3.org/checklink To easy and convenience, you can use web developer add-on Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 11. Add support for site page * Support compatible cross browser. + Browser hack  Use asterisks mark Ex: For IE 5.5 & IE 6 * html .test { position: absolute;} For morder browser .test { position: fixed; }  Use backflash mark Ex: .test { height: 500px; // For IE 5.5 height: 400px; // For morder browser } Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 12.  Use underscore mark Add support for site page (cont) Ex: .test { position: fixed; /* For morden browser */ _position: absolute; /* For IE <= 6 */ } For more details, you can reference: browserhacks.com  Use selector don’t exist in old browser Ex: #test { position: absolute;} html > body #text { position: fixed;} Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 13.  -ms- : Microsoft Internet Explorer  -moz- : Mozilla Firefox Add support for site page (cont) + Add vendor prefix for CSS3 properties Ex: .box_rotate { -webkit-transform: rotate(-20deg); /* Chrome, Safari 3.1+*/ -moz-transform: rotate(-20deg); /* Firefox 3.5 - 15 */ -ms-transform: rotate(-20deg); /* IE 9 */ -o-transform: rotate(-20deg); /* Opera 10.50-12.00 */ transform: rotate(-20deg); /* Firefox16+,IE 10+,Opera 12.10+ }  -webkit- : Google Chrome & Safari  -o- : Opera  -kthml- : Konqueror For more details, you can reference: caniuse.com Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 14. Add support for site page (cont) + Embed direct JavaScript into CSS * Use JavaScript Ex: h1#fixed { position: absolute; top: expression((d = document.compatMode == "CSS1Compat"?document.documentElement : document.body)&&(eval(d.scrollTop)) ); } + Use JavaScript library  To use HTML5 in older browsers, you could us HTML5.js (http://html5shim.googlecode.com/svn/trunk/html5.js) or html5shiv (https://code.google.com/p/html5shiv) Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 15. * Supports a variety of different devices Add support for site page (cont)  To use CSS3 properties in old browser, you can use PIE (http://css3pie.com)  To use media query in old browser, you can use css3-mediaqueries- js (http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3- mediaqueries.js)  To fix some common bugs in IE, you can use IE9.js (https://github.com/mylovecompany/ie9-js)  To support a variety of different devices, you can use CSS Media Queries Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 16. Add support for site page (cont) Ex: @media screen { body { width: 75%; } /* Support for screen */ } @media print { body { padding: 1in; border: 0.5pt solid #666; /* Support for printer*/ } } @page { margin: 2.5cm; /* default for all page */ } @page:left { margin-left: 5cm; /* only for left-page */ } Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 17. Add support for site page (cont) * Supports a variety of screen sizes  Similar, to support a variety of screen sizes, you can use CSS Media Queries for different screen sizes Ex: @media screen and (max-width: 980px) { #pagewrap {width:95%;} } @media screen and (max-width: 650px) { #pagewrap {width:65%;} } @media screen and (max-width: 480px) { #pagewrap {width:35%;} } Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 18. Optimize source code 1. Optimize images * Always use Save for Web & Deveice when save an image in Photoshop. * Selecting the appropriate image format. + GIF (Graphics Interchange Format)  Use LZW method to compress image.  Support transparent, animation.  Only support a maximum of 256 colors Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 19. + JPG (Joint Photographic Experts Group) Optimize source code (cont)  Support 16.7 million color  Support progressive image + PNG (Portable Network Graphics)  Support 8-bit color (GIF) and also support 24-bit RGB (JPG)  Support transparent image, but not support animation  Don’t support in old browser Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 20. Optimize source code (cont) * Use Image Sprite technical + A collection of images put into a single image. + Reduce the number of server requests and save bandwidth. + Online tools:  Spritepad (spritepad.wearekiss.com)  Project Fondue (spritegen.website-performance.org)  CSS Sprites Generator (csssprites.com) * Use image compressor  Dynamic Drive (tools.dynamicdrive.com)  Web Resizer (webresizer.com)  Kraken.io (kraken.io)Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 21. 2. Optimize HTML + Remove unnecessary white spaces, line breaks, tabs,… 3. Optimize CSS + Filter unnecessary selector, CSS shorthand, sort properties, compress colors,… + Tools:  CSS Beautifier (http://www.codebeautifier.com)  Clean CSS (http://cleancss.com)  Robson CSS Compressor (http://iceyboard.no-ip.org/projects/css_compressor) Optimize source code (cont) Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City
  • 22. Web tool Editor: Sublime Text + plugins: emmet, autoprefix, browser frefesh, fetch,… Software: Texter, Browser Chooser, IE Tester Website: http://designveloper.com Address: 250/6 Bau Cat, Ward 11, Tan Binh District, HCM City