The CSS and XHTML Lab
This is a collection of experiments, methods, tips and tricks related to CSS and XHTML that may or may not come in handy some day. Some of these techniques are based on ideas of my own, others are based on techniques, tutorials, and ideas that I’ve come across on the web, on mailing lists, in books, and other places.
Some of these examples have step-by-step instructions while others do not. I hope to eventually get around to writing instructions/explanations for all of these examples.
If you want to use any of these techniques, go ahead, take a look at the (X)HTML and CSS to learn how it's done. However, for the techniques that use images I ask that you please create your own.
If you ask me for help on how to implement this stuff and don’t get a quick response, it’s not because I’m ignoring you or don’t want to help. I just don’t have the time to help everyone. Sorry about that. If you have specific questions related to CSS, a good place to look for help is the css-discuss mailing list.
Demos and techniques
- CSS Frames
- The look of frames without using frames.
- CSS Tabs, separate lists
- A two-level tab menu based on separate unordered lists.
- CSS Tabs, nested lists
- A two-level tab menu based on nested unordered lists.
- CSS Tabs, nested lists (Listamatic 2)
- A two-level tab menu based on separate unordered lists. Based on the HTML from Listamatic 2.
- CSS Teaser Box, fixed width
- A fixed width box with rounded corners. It uses no extra markup and just one image.
- CSS Teaser Box, flexible width
- A flexible width (and height) box with rounded corners. It uses very little extra markup and two images.
- Dropshadow
- A simple dropshadow effect.
- Equal height boxes with CSS
- Side-by-side elements that behave like table cells.
- Equal height boxes with CSS, part II
- Side-by-side elements that behave like table cells. Some workarounds to prevent Internet Explorer from breaking down completely.
- Flexible box with custom corners and borders
- A flexible width (and height) box with custom corners and borders.
- Horizontal centering
- A very basic example of horizontal centring with CSS.
- Horizontal and vertical centring
- Horizontal and vertical centring with CSS.
- Inverted Sliding Doors Tabs
- Upside down tabs based on the Sliding Doors technique. Also available in Italian (translation by Egidio Murru).
- News list
- A list of vertically expandable boxes with rounded corners.
- Rounded corners
- An older example of a box with rounded corners.
- Soft dropshadow
- A somewhat limited way of creating a nice and soft dropshadow.
- Styling form controls
- Examples of CSS applied to form elements.
- Transparent custom corners and borders
- Create a resizable box with custom, transparent corners and borders and no extra markup. A much improved version of the Flexible box with custom corners and borders demo.
- Two column CSS layout with full width header and footer
- Fixed width, centred horizontally.
Translated articles
Some of the articles I've written have been translated to other languages than English. All Swedish translations are done by myself.
- 10 must haves in IE Next
- A three-part article series that explains the selectors that are available in CSS 2.1. Available in the following languages:
- Brazilian Portuguese: 10 itens para a próxima versão do IE (Translation by Mauricio Samy Silva)
- English: 10 must haves in IE Next
- 10 colour contrast checking tools to improve the accessibility of your design
- A list of tools that help make your design readable to all users by checking if text has sufficient contrast against its background. Available in the following languages:
- Accessibility myths and misconceptions
- What accessibility is and is not:
- Chinese: 親和力迷思與錯誤觀念 (Translation by OOO)
- English: Accessibility myths and misconceptions
- French: Mythes et Idées fausses sur l’accessibilité (Translation by Marie ALHOMME)
- German: Zugänglichkeit: Mythen und falsche Vorstellungen (Translation by Eric Eggert)
- Spanish: Mitos y Conceptos Erróneos sobre la Accesibilidad (Translation by Gabriel Porras)
- Turkish: Erişilebilirlik hakkındaki Efsane ve Yanlış Anlaşılmalar (Translation by Orhan Veli Firik)
- Are we designers or developers
- If you do not do graphic design, but work with HTML, CSS, JavaScript, and accessibility, are you a designer or a developer? Available in the following languages:
- Bulgarian: Дизайнери или дивелъпъри? (Translation by Michel Bozgounov)
- Dutch: Ontwerpers of ontwikkelaars? (Translation by Michael Dierckx)
- English: Are we designers or developers
- German: Sind wir Designer oder Entwickler? (Translation by Birgit Zimmermann)
- Greek: Είμαστε designers ή developers; (Translation by Yiannis Konstantakopoulos)
- Japanese: [Web]僕たちはデザイナーか、それともデベロッパーか? (Translation by Arata Kojima)
- Spanish: ¿Somos diseñadores o desarrolladores? (Translation by Fer Torres)
- Barrier-free Web design, a.k.a. Web accessibility 2.0
- A joint attempt by myself and Tommy Olsson to explain why we believe that including everybody does not risk excluding people with disabilities.
- English: Barrier-free Web design, a.k.a. Web accessibility 2.0
- Italian: Web design senza barriere, ovvero accessibilità 2.0 (Translation by Franco Carcillo)
- Basics of search engine optimisation
- Basic tips for Search Engine Optimisation: add quality content regularly and make sure your site is well-built.
- English: Basics of search engine optimisation
- Italian: Ottimizzazione per i motori di ricerca (SEO): Principi di base (Translation by Luca Magnani)
- Polish: Podstawy optymalizacji dla wyszukiwarek (Translation by Marcin Gaik)
- Spanish: Principios para la Optimización en Buscadores (Translation by Gabriel Porras)
- Bring on the tables
- How to use HTML tables the right way – to create accessible data tables:
- Chinese: 标准化——表格 (Translation by JunChen)
- English: Bring on the tables
- French: Au tableau ! (Translation by Pompage.net)
- Russian: Практический HTML: работаем с таблицами (Translation by DreamwinD)
- CSS 2.1 Selectors
- A three-part article series that explains the selectors that are available in CSS 2.1. Available in the following languages:
- Arabic: مُحدِّدات CSS 2.1 (Translation by Ahmad Bagadood)
- Brazilian Portuguese: Seletores CSS 2.1 Parte 1, Seletores CSS 2.1 Parte 2, Seletores CSS 2.1 Parte 3 (Translation by Mauricio Samy Silva)
- Chinese: [译稿]细说CSS样式选择符(一)——CSS 2.1 Selectors, [译稿]细说CSS样式选择符(二)——CSS 2.1 Selectors, [译稿]细说CSS样式选择符(三)——CSS 2.1 Selectors
- Dutch: CSS 2.1 Selectors, deel 1, CSS 2.1 Selectors, deel 2, CSS 2.1 Selectors, deel 3 (Translation by Arjan Snaterse)
- English: CSS 2.1 Selectors Part 1, CSS 2.1 Selectors Part 2, CSS 2.1 Selectors Part 3
- French: Sélecteurs CSS 2.1, partie 1, Sélecteurs CSS 2.1, partie 2, Sélecteurs CSS 2.1, partie 3 (Translation by Manuel Catez)
- Polish: Selektory CSS 2.1 - część 1, Selektory CSS 2.1 - część 2, Selektory CSS 2.1 - część 3 (Translation by Łukasz Adamczuk)
- Spanish: Selectores CSS 2.1, Parte 1 (Translation by Juan Pablo Brocca)
- CSS 3 selectors explained
- CSS 3 brings us many powerful new CSS selectors. Browser support is currently lacking, but taking a look at what lies ahead is still useful. Available in the following languages:
- Brazilian Portuguese: Seletores CSS3 (Translation by Maurício Samy Silva)
- English: CSS 3 selectors explained
- Italian: I selettori CSS3 illustrati (Translation by Gabriele Romanato)
- CSS Frames v2, full-height
- Create the visual effect of HTML frames with CSS and make the scrolling area stretch to 100% height regardless of the amount of content. Available in the following languages:
- English: CSS Frames v2, full-height
- French: Les cadres en CSS
- CSS tips and tricks
- My favourite time and trouble savers when working with CSS. Available in the following languages:
- Chinese: CSS的十八般技巧 (Translation by ajie)
- English: CSS tips and tricks Part 1, CSS tips and tricks Part 2
- French: Trucs et astuces CSS I (Translation by Normand Lamoureux)
- Polish: Sztuczki w CSS, Część 1, Sztuczki w CSS, Część 2 (Translation by Marcin Gaik)
- Spanish: CSS mas eficiente utilizando abreviaturas ~ Parte 1 (Translation by Dan Goldfeder)
- Developing with web standards
- A document on web standards and accessibility. Available in the following languages:
- Brazilian Portuguese: Desenvolvendo com os Web Standards (Translation by Ricardo Augusto)
- Bulgarian: Да работим по уеб стандартите (Translation by Boby Dimitrov)
- Chinese: 伴随着Web标准发展 (Translation by Liushen)
- Dutch: Ontwikkelen met web standaarden (Translation by Fabian Deceuninck)
- English: Developing with web standards
- Finnish: Web-julkaiseminen ja standardit (Translation by Yoji Hirabayashi, Mikko Kekki, and Pekka Peltonen)
- French: Développer avec les standards Web (Translation by Clément Hardouïn)
- German: Entwickeln mit Webstandards (Translation by Christian Machmeier) and Webdesign mit Webstandards (Translation by Andreas Kalt)
- Italian: Sviluppare con gli Standard del Web (Translation by Mirko Corli and Franco Carcillo)
- Norwegian: Standardbasert utvikling for nettet (Translation by Thomas Hammer)
- Russian: Разработка с Веб-Стандартами (Translation by Alexander Shabuniewicz)
- Swedish: Webbutveckling med standarder
- Turkish: Web Standartlarını Kullanarak Geliştirmek (Translation by Mert Derman)
- Efficient CSS with shorthand properties
- Save space in your CSS files by using shorthand. Available in the following languages:
- English: Efficient CSS with shorthand properties
- Polish: Efektywny CSS ze skróconymi właściwościami (Translation by Piotr Janeczek)
- Evaluating Website Accessibility
- A three-part article series that explains how to evaluate the basic accessibility of a website.
- Chinese: 网站亲和力评估 Part 1:背景与准备 (Translation by Liushen)
- English: Evaluating Website Accessibility Part 1, Background and Preparation, Evaluating Website Accessibility Part 2, Basic Checkpoints, Evaluating website accessibility Part 3, Digging Deeper
- French: Évaluer l’accessibilité d’un site web, première partie : Les préliminaires (Translation by Pompage.net)
- German: Die Evaluierung von Webseitenzugänglichkeit Teil 1, Hintergrund und Vorbereitung, Die Evaluierung von Webseitenzugänglichkeit Teil 2, Grundlegende Prüfabschnitte, Die Evaluierung von Webseitenzugänglichkeit Teil 3, Das Nachhaken (Translation by Nadja Müller)
- Italian: Valutazione dell’accessibilità di un sito web – Parte Prima, storia e preparazione, Valutazione dell’accessibilità di un sito web - Parte Seconda, controlli di base, Valutazione dell’accessibilità di un sito web - Parte Terza, scavando più a fondo (Translation by Luca Magnani)
- Turkish: Site Erişilebilirliğinin Derecesinin Tespiti Bölüm 1, Altyapı ve Hazırlıklar, Site Erişilebilirliğinin Derecesinin Tespiti Bölüm 2, Temel Kontroller, Site Erişilebilirliğinin Derecesinin Tespiti Bölüm 3, Dibini Kazımak (Translation by Orhan Veli Firik)
- Guidelines for creating better markup
- Some guidelines that will help you improve the quality of your markup. Available in the following languages:
- English: Guidelines for creating better markup
- Russian: 6 основных рекомендаций по улучшению качества вёрстки веб-страниц (Translation by Vsevolod Kozlov)
- How to prevent HTML tables from becoming too wide
- A rarely used CSS property comes to the rescue when dealing with oversized content in tables. Available in the following languages:
- Brazilian Portuguese: Tabelas quebrando layout (Translation by Maurício Samy Silva)
- English: How to prevent HTML tables from becoming too wide
- Lame excuses for not being a Web professional
- Excuses that may be valid in some circumstances are too often used to cover up somebody’s lack of knowledge about modern Web design or development. Available in the following languages:
- English: Lame excuses for not being a Web professional
- Indonesian: Alasan Konyol untuk Tidak Menjadi Seorang Profesional (Translation by Anggie Bratadinata)
- Levels of HTML knowledge
- Humorous descriptions of a few different levels of HTML knowledge among people working in the web industry. Available in the following languages:
- English: Levels of HTML knowledge
- Spanish: Niveles de conocimiento HTML (Translation by Christian Van Der Henst)
- Turkish: HTML bilgi düzeyleri (Translation by Eren Emre Kanal)
- Ten reasons to learn and use web standards
- Some of the most important reasons for spending the time to learn all about using web standards to design and develop websites. Available in the following languages:
- Brazilian Portuguese: 10 razões para aprender e usar os web standards (Translation by Leandro Vieira Pinho) and Dez razões para aprender e usar web standards (Translation by Ranieri Teixeire)
- English: Ten reasons to learn and use web standards
- French: Dix raisons pour apprendre et utiliser les standards du Web (Translation by Nicolas Gruson)
- German: Gründe für webstandards-basiertes Webdesign (Translation by Martin Labuschin)
- Polish: 10 powodów dla których warto stosować standardy (Translation by Marcin Gaik)
- Russian: 10 причин, чтобы изучать и использовать веб-стандарты
- Spanish: Diez razones para aprender y usar los estándares Web (Translation by Gabriel Porras)
- Turkish: Web Standartlarını Öğrenmek ve Kullanmak için 10 Sebep (Translation by Orhan Veli Firik)
- The alt and title attributes
- Explaining the
altandtitleattributes, along with some guidelines on how and when to use them. Available in the following languages:- Chinese: alt属性和title属性 (Translation by JunChen)
- English: The alt and title attributes
- The perils of using XHTML properly
- A discussion of the issues involved in serving XHTML with the
application/xhtml+xmlMIME type. Available in the following languages:- Chinese: 正确使用XHTML的冒险 (Translated by Neo, edited by JunChen)
- English: The perils of using XHTML properly
- Turkish: Doğru XHTML Kullanımı (Translation by Orhan Veli Firik)
- Turning a list into a navigation bar
- How to use CSS to create a horizontal navigation bar out of a simple ordered list. Available in the following languages:
- Web development mistakes
- A list of mistakes frequently encountered on the web. Available in the following languages:
- Chinese: web设计与开发常见错误 (Translation by JunChen)
- English: Web development mistakes
- French: Erreurs de Développement Web (Translation by Marie Alhomme)
- Polish: Błędy w tworzeniu stron WWW (Translation by Maciej Łebkowski)
- Spanish: Errores comunes del desarrollo web (Translation by Hermann Kaser)
- Swedish: Vanliga misstag inom webbuteckling
- Why standards still matter
- The last couple of years may have seen an increase in the level of interest and action around web standards. But it still isn't filtering down to the mainstream… Available in the following languages:
- English: Why standards still matter
- French: Pourquoi les standards comptent toujours (Translation by Marie ALHOMME)
- German: Weshalb Webstandards immer noch wichtig sind (Translation by Eric Eggert)
- Polish: Standardy niezmiennie ważne (Translation by Dominik Paszkiewicz)
Information, sponsorship, and externals
About the author
Roger Johansson is a Swedish web professional specialising in web standards, accessibility, and usability. More about me and this site.
Latest articles
- Validation statistics from Nikita the Spider Comments off
- An analysis of the sites crawled by the bulk validation tool Nikita the Spider during March 2008.
- Authentic Jobs API and Affiliates program Comments off
- The Authentic Jobs job listing service now has a public API and an affiliate program.
- What does Acid3 mean to you and me? Comments off
- Opera and Apple have announced that their web browsers pass the Acid3 Browser Test, but how will that help web designers and developers?
- Designing Web Navigation (Book review) Comments off
- Learn the fundamentals of navigation design and design better navigation systems for large and small sites as well as for web based applications.
- DOMAssistant bundle for TextMate Comments off
- To save keystrokes and speed up development I have created a DOMAssistant bundle for TextMate.
- First impressions of Internet Explorer 8 Beta 1 Comments off
- My impressions after trying out Internet Explorer 8 Beta 1 for a couple of days.








