Posts Tagged HTML

Posted on Programming

Climbing down trees

Just in case anyone isn’t clear on this, I’m going to explain, in detail, how to descend the object tree with your CSS selectors. Let me know if I’ve skipped or glossed over any important details. Return any hand-waving in kind.

If you’re thinking WTF is an object tree?, you should know that I often just make up names. Hopefully in this case it proves descriptive.
I think of HTML as a tree: At the tree’s top is the <html> tag; Its descendants are all the tags nested within it.
(more…)

Posted on Programming

Imagined generality

One of the reasons i like HTML and CSS is because in my mind every tag is exactly the same, the only differences being in default CSS values for various tags. Now, this is obviously not the case, but it’s nice to believe. It’s for the same reason that i thought scheme was so pretty.

For such an inaccurate mental model, it works out rather well.

It’s when the lie is highlighted that I become frustrated or, worse, annoyed. Which is why I am not a fan of how certain tags can’t self close.
(more…)

Posted on Programming

Magically managing menus

Hey, so, I’m going to detail my method for making menus. I’ll try as well to explain the reasons behind the choices I make. If you have any questions, let me know and I’ll try to fabricate a plausible answer.

Two popular menu types are drop down menus, and your basic expanding lists. But good news, the HTML we use for both is the same! Why? Because they’re both menus! They may look different, but in essence they’re nothing but a nested list of links. And in my opinion, we should do our best to use HTML to describe the data we’re presenting.

One big bonus is that if we take out the CSS, the website still usable. We can also easily provide alternate stylesheets for things like mobile phones, and pages are easy to navigate from text-based browsers. Most importantly, the HTML is short, clear, and easily readable.

Which is why I’m going to use nested lists. The styling will be done with CSS, and some event handling with Javascript (I’ll use JQuery because it’s nice, but don’t feel tied to it).

I’ve prepared a page complete with code quotes and comments:

I was too lazy to style it. Also, the magic was a trick. There was no magic. I’m sorry.

Your friend,
Brad