SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

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

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

Mais de 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
 

Mais de 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
 

Último

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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, Adobeapidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
🐬 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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

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