Archive: HTML/(X)HTML
<code> and <pre>: Semantic Code Markup: A Quick Tip
Posted on Saturday, August 19th, 2006
I recently came across some problems whilst posting code on this blog. I was showing the javascript for my font sizing and stylesheet switching scripts and found that it was often awkward to format and display the code properly, even though I am using styled code tags around it.
The Problems
Indenting, line breaks… all the formatting that I had applied to make the code clearer to myself disappeared. Then I remembered the HTML element that retains that formatting; the <pre> (preformatted text) element. Using <pre> instead of <code> would make the script appear clearer and easier to understand. However, semantically the code element Designates a fragment of computer code.
I want my markup to remain as meaningful as possible so what is the solution?
Continue reading “<code> and <pre>: Semantic Code Markup: A Quick Tip” »
Stylesheet Switcher - Part 2
Posted on Friday, August 18th, 2006
Yesterday I began to create a stylesheet switcher using javascript and the HTML DOM. I finished up with an example of the work so far, but I failed to address a few of the points in my requirements, namely:
- Use a dropdown box to select styles
- Populate the dropdown box with stylesheet names from the title attribute of the link tag
- Graceful degradation in browsers without script
- Future proof javascript
Today I will tackle these issues.
IF Internet Explorer THEN Do Something Else
Posted on Monday, August 14th, 2006
I have been working on my first job this week, hence my lack of posting recently. It has been quite an experience finally designing a site for someone else, but this is not really the issue on my mind.
The Box Model Hack Strikes
The design of the site that I was creating this week prompted me to think about support for CSS within IE and the highly documented ways to work around it. I was using the CSS from the method for sticking a footer to the bottom of a page from A List Apart and noted the use of Tantek Çelik’s box model hack. As I progressed with the design, I came to rest on a fixed width layout and deployed the box model hack again. By the time I came around to the third use of the hack I had almost forgotten what the first two were for and had to read the code carefully to work out what I was trying to achieve.
Continue reading “IF Internet Explorer THEN Do Something Else” »