web developer & system programmer

coder . cl

ramblings and rants on software development...


Print Article R -a +A

theme change and some css tricks

by Daniel Molina Wegener on 2009.09.11
posted in: programming, tips

If you are frequent visitor of my blog, you has noticed immediately that I’ve changed my blog theme. I build my own them, like the last one. The difference between both themes, is the fact that the last theme was made using modifications for Internet Explorer and a common and working CSS style for all other browsers. I’ve used the common ie-sucks.css Internet Explorer modifications file. Just look at the Internet, many Web Designers are using it. While I was working in the new theme of my blog, I was observing the CSS changes and all the tricks to build a portable CSS is the fact that all resides in the element hierarchy and precedence. If you know about CSS, you must consider the following rules:

  • element specification has the lowest priority.
  • element class specification has the middle priority.
  • element identifier specification has priority.
  • form elements with class or element specifier are not handled in Internet Explorer in versions prior to 6.0 when an element identifier is encapsulating it or highest priority element are encapsulating them.
  • the !important modification can be used to force specifier priority — for example, element specification over element identifier specification.
  • the !important modification can override by precedence all child elements in their specifiers and another !important modification can override the parent specification.
  • Internet Explorer has a bug since it do not regards the parent element size. In other words, a width and height specifier for the parent element is override by child elements if they don’t fit the parent size. It has a special consideration with DHTML elements, since they have a higher priority because they are added at the final stage of web page rendering.

People which knows about CSS will not have problems reading those rules and understanding them. Special thanks to Ricardo Osorio, who helped me in my first steps with CSS and I repeat again, I want to learn good CSS just to have good communications with Web Designers using a common language, and sincerely I can’t build good web designs. Also, I’m thinking to build a CSS tidier, like csstidy, but with a smarter compression algorithm and specifier hierarchy analysis. I know, is a hard to do project: it requires a parser, a tree — for the hierarchy analysis — and an source indenter.


No coments yet.

post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>