HTML/CSS
Jump to navigation
Jump to search
to merge from bits of design. aaand break out. and generally sort.
Standards
- W3C Standards for the Open Web Platform
HTML
- HTML Living Standard - browser company base standard
- HTML5: A technical specification for Web developers
- HTML: The Markup Language
- HTML5: Edition for Web Authors - omits UA aspects
- HTML5: Editor's Draft - bleeding edge w3c
- On the WHATWG HTML Living Standard process - Feb 25, 2012
- Update on the relationship between the WHATWG HTML living standard and the W3C HTML5 specification - 19th Jul, 2012
- HTML 5 gets forked up - 23rd July, 2012 [1]
CSS
- W3C: CSS (2010 snapshot)
Docs, guides, etc.
Basics
- A Beginner’s Guide to HTML & CSS is a simple and comprehensive guide dedicated to helping beginners learn HTML and CSS. Outlining the fundamentals, this guide works through all common elements of front-end design and development.
- Dive Into HTML5 by Mark Pilgrim
- http://stac.ly/cheat/
- Mozilla Developer Network
- Introduction to The Web Standards Curriculum - opera
- Web Education Community Group Wiki - w3c
Resources
- HTML5 Tutorials for Keeping Your Design Skills Tight - Jul 23, 2012
- HTML5 Rocks: Resources
- The Evolution of the Web
Articles
- About HTML semantics and front-end architecture
- HTML5 id/class name cheatsheet - Or, “The mapping of HTML5 structural elements to id and class names for use with divs”
- Principles of writing consistent, idiomatic CSS
- Scalable and Modular Architecture for CSS - A flexible guide to developing sites small and large.
- http://blog.responsivenews.co.uk/post/18948466399/cutting-the-mustard
Project basics
Favicon
- http://www.allthefavicons.com/ - does it all
Project templates
- http://html5boilerplate.com/ - "it's not a framework, it's just a bunch of files"
- Twitter Bootstrap
- http://jetstrap.com/
Resets, normalize, etc.
Different browsers have different defaults.
- http://stackoverflow.com/questions/6887336/what-is-the-different-between-normalize-css-and-reset-css
Polyfills, shim/shivs
For fixing the lack of HTML5/CSS3 support in older browsers.
- Modernizr is a small JavaScript library that detects the availability of native implementations for next-generation web technologies, i.e. features that stem from the HTML5 and CSS3 specifications. Many of these features are already implemented in at least one major browser (most of them in two or more), and what Modernizr does is, very simply, tell you whether the current browser has this feature natively implemented or not.]
- Custom download - Use the Development version to develop with and learn from. Then, when you’re ready for production, use the build tool to pick only the tests you need.
- Documentation
- https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
- http://yepnopejs.com/ - used in modernizer
- http://www.useragentman.com/blog/csssandpaper-a-css3-javascript-library/
- http://ecsstender.org/
- http://selectivizr.com/
Filters
Structure and elements
- MDN: Sections and Outlines of an HTML5 Document
- HTML5 Doctor: Document Outlines - July 12th, 2011
- sections;
- body, section, nav, article, aside, h1, h2, h3, h4, h5, h6, hgroup, header, footer, address
- grouping;
- p, hr, pre, blockquote, ol, ul, li, dl, dt, dd, figure, figcaption, div
- text level;
- a, em, strong, small, s, cite, q, dfn, abbr, data, time, code, var, samp, kbd, sub/sup, i, b, u, mark, ruby, rt, rp, bdi, bdo, span, br, wbr
Lists
- MDN: Lists
From Wikipedia;
list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAANAQMAAABb8jbLAAAABlBMVEX///8AUow5QSOjAAAAAXRSTlMAQObYZgAAABNJREFUCB1jYEABBQw/wLCAgQEAGpIDyT0IVcsAAAAASUVORK5CYII=);
Forms and buttons
- http://nicolasgallagher.com/lab/css3-github-buttons/
- http://www.red-team-design.com/css3-patterned-buttons
Pseudo-elements
q::before { content: "»" } q::after { content: '«' }
Was just one colon, but CSS3 added another to distinguish from pseudo-classes.
content: ""; needed to display
- http://www.impressivewebs.com/before-after-css3/
- http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/
Units
- CSS Values and Units Module Level 3 - W3C Working Draft 8 March 2012
- CSS Values and Units Module Level 3 - Editor's Draft 19 July 2012
- 1em - element font size (affected by element nesting depth)
- 1rem - root element font size
- 1em = 16px (by default anyway)
- 1px (css pixel) = 1/96in
- 1vp = 1% viewport width
- 1in (inch) = 2.539954cm
- 1pt (point) = 1/72in
- 1pc (pica) = 12pt
- https://developer.mozilla.org/en-US/docs/CSS/length
- https://developer.mozilla.org/en-US/docs/CSS/angle
rem
- http://coderwall.com/p/1v6gfq
- ROOT EM! Using CSS3 "rem" Units for "Elastic Pixels"
- http://tetsubo.org/2012/01/developing-with-rem-based-layouts/
- http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
- https://github.com/ry5n/rem - sass mixin
v*
100vw == window.width
examples
color
Selectors
- Selectors Level 3
- W3C Recommendation 29 September 2011
- Selectors Level 4 - implemented in sass
- http://www.w3.org/community/webed/wiki/CSS/Selectors
- http://twostepmedia.co.uk/cssselectors/
- http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/
- http://csswizardry.com/2012/07/shoot-to-kill-css-selector-intent/
h1 + h2 <h1></h1><h2></h2> h1 > h2 <h1><h2></h2></h1>
Specificity
p has a specificity of 1 (1 HTML) div p has a specificity of 2 (2 HTML; 1+1) .sith has a specificity of 10 (1 class) div p.sith has a specificity of 12 (2 HTML and a class; 1+1+10) #sith has a specificity of 100 (1 id) body #darkside .sith p has a specificity of 112 (HTML, id, class, HTML; 1+100+10+1)
http://news.ycombinator.com/item?id=4388649
Pseudo-classes
- MDN Pseudo-classes
From Pseudo Class Selectors;
- root - Selects the element that is at the root of the document. Almost certainly will select the <html> element, unless you are specifically working in some weird environment that somehow also allows CSS. Perhaps XML.
- first-child - Selects the first element of its type within a parent.
- last-child - Selects the last element of its type within a parent.
- nth-child(N) - Selects elements based on a simple provided algebraic expression (e.g. "2n" or "4n-1"). Has the ability to do things like select even/odd elements, "every third", "the first five", and things like that. Covered in more detail here with a tester tool.
- nth-of-type(N) - Works like :nth-child, but used in places where the elements at the same level are of different types. Like if inside a div you had a number of paragraphs and a number of images. You wanted to select all the odd images. :nth-child won't work there, you'd use div img:nth-of-type(odd). Particularly useful when working with definition lists and their alternating -dt- and -dd- elements.
- first-of-type - Selects the first element of this type within any parent. So if you have two divs, each had within it a paragraph, image, paragraph, image. Then div img:first-of-type would select the first image inside the first div and the first image inside the second div.
- last-of-type - Same as above, only would select the last image inside the first div and the last image inside the second div.
- nth-last-of-type(N) - Works like :nth-of-type, but it counts up from the bottom instead of the top.
- nth-last-child(N) - Works like :nth-child, but it counts up from the bottom instead of the top.
- only-of-type - Selects only if the element is the only one of its kind within the current parent.
Layout
display
display: block - default 100% width, flows vertically display: inline - consumes width of content, flows horizontally display: inline-block display: table-cell - vertical align method [6] http://www.quirksmode.org/css/display.html
float
float - floats element next to containing box or other floated element
position
position: absolute - out of flow position: fixed
- https://github.com/andreasbovens/understanding-viewport
- http://www.brainjar.com/css/positioning/default.asp
vertival align
- http://blog.themeforest.net/tutorials/vertical-centering-with-css/ [7]
- http://css-tricks.com/what-is-vertical-align/
- http://www.barelyfitz.com/screencast/html-training/css/positioning/
overflow
http://colinaarts.com/articles/the-magic-of-overflow-hidden/
z-index
z-index works only on absolute or relative positioned elements.
- https://developer.mozilla.org/en-US/docs/CSS/Understanding_z-index
- http://en.wikipedia.org/wiki/Z-index
via js;
object.style.zIndex="1"
flexbox
Tips
- http://paulirish.com/2012/box-sizing-border-box-ftw/ [8]
- http://stackoverflow.com/questions/2429819/why-is-the-w3c-box-model-considered-better
- http://css-tricks.com/float-center/
- http://stackoverflow.com/questions/963636/why-cant-i-center-with-margin-0-auto
css is stoopid
Text
Text stroke
Webkit only.
- http://www.westciv.com/tools/textStroke/ - generator
Properties
border
background
- http://www.tizag.com/cssT/background.php/
- http://whereswalden.com/files/mozilla/background-size/more-examples.html
- http://css-tricks.com/perfect-full-page-background-image/
- http://www.vanseodesign.com/css/background-properties/ - w/ css3
linear-gradient
mask
white-space
- https://developer.mozilla.org/en-US/docs/CSS/white-space
- http://www.quirksmode.org/css/whitespace.html - view source for examples
Sprites
ls 1.png 2.gif dot.png phoney.gif tw.gif convert *png *gif -append result/result-sprite.png
- Sprite Cow helps you get the background-position, width and height of sprites within a spritesheet as a nice bit of copyable css.
- http://spriteme.org/ - bookmarklet that makes sprite images and code from existing pages
- http://yostudios.github.com/Spritemapper/ - python
Data
Animations
- http://www.w3.org/TR/css3-animations/
- https://developer.mozilla.org/en/CSS/CSS_animations
- http://www.jasondavies.com/animated-bezier/
- http://daneden.me/animate/
Transitions
- https://developer.mozilla.org/En/CSS/CSS_transitions
- https://developer.mozilla.org/en-US/docs/CSS/Using_CSS_transitions
Transforms
- CSS3Warp is a small (<8kb minified unzipped) javascript library for warping any HTML text around an arbitrary path. Text will look as if it were created with Illustrator's attach-to-path tool. Anyway it is pure HTML text that can be styled with CSS, copied and crawled. csswarp works standalone and does not rely on jQuery or another library (a jQuery plugin is in the works though). csswarp.js offers an extensive number of settings to adjust text warping. Right now it will work in every modern browser that supports css3 transforms. Support for IE versions <9 is planned for a future release.
Filters
Canvas
- Canvas Editor for Chrome
Microdata
- http://jsfiddle.net/6PSVU/ - bottom: 0;
Outline
- http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines
- http://htmldog.com/reference/cssproperties/outline/
Full screen
Shapes
Misc
- http://davatron5000.github.com/deCSS3/ - bookmarklet to test pre css3 browsers
- http://www.youtube.com/watch?v=a2_6bGNZ7bA Faster HTML and CSS: Layout Engine Internals for Web Developers
Frameworks
Accessibility
See also Design
Headings should not be removed using display:none, because it removes the headings from assistive technology. Instead headings can be made invisible to sighted users using CSS class="element-invisible". [10]