Tips and Tricks
These are best practices. You should follow these simple rules to create semantic documents that do not suffer from DIVitis.
- The proper way to put the snippets of code together:
- You should insert a module or a layout into another by replacing an
ez-boxDIV with a module or layout of your choice. Modules and layouts should not be direct children ofez-boxcontainers (these should only be used to hold content). By the same token, and as seen in the screencast, anez-wrDIV should not be the single child of anotherez-wrDIV. - Do not keep
ez-boxcontainers if you don't need to: - If you do not need to style
ez-boxcontainers to achieve the design you want, then you can safely remove them from your markup and insert your content directly into the parent DIV. This is what we have done on this site, there are noez-boxDIVs in the left and right columns. Check the proper way to cut and paste modules and layouts to avoid DIVitis. - Do not use
identifiers to style your documents: - To make sure you can insert new modules or layouts later into your documents, you should not use classes used by
as selectors for your rules. The same goes with classes used to set default widths, you should not edit their value (replacing 50% in the .ez-w-50 {}rule with600pxfor example). Instead, you should set your own hooks (classandid) on the appropriate elements. - When adding
classandid, think of HTML5 and ARIA: - Why not use names inspired from the new semantic elements in HTML5? And what about including ARIA "Landmark" roles at the same time?
- Do not use the solution for prototyping in production:
- This solution may be "cool", but using
fieldsetas a structural hack goes against best practices. - Create a gutter between two columns by applying margin to the float:
- The best way to create a gutter between columns is to apply
marginon columns that are floats. If for some reason you need to style anez-lastbox instead (a width-less column), then usepaddingrather than margin. - To prevent long strings breaking your layout in IE 6:
- Because IE 6 treats
widthasmin-width, content may increase the width of your columns. You can force strings (i.e.,URIs) to break by usingword-wrap:break-word.
Search


