Avoiding the Div Mentality

Why it is important to know the tools you have rather than make new ones.

Back to Home

So, as you may have noticed, I decidet to add a navigation bar to the main pages on my site. (if my home page doesn't look different rplace index.html with blogstyle.css in the URL bar then refresh it and go back, but you shouldn't have to do that, I doubt the old version is casched in your browser like mine is) Being a computer science student I was trying to impliment it in some fancy way that I was taught in school, I tried doing it how I did in an assignment, I tried doing it how I've seen in other sites, but I couldn't get any fancy way of doing it to work right, I also knew that if I did do it any fancy custom way I'd baisically have to do it twice in order for it to look good on phones and desktop, and I wasn't looking forward to that. I then decided to look up how to impliment it better, and I found that I didn't need all that fancy stuff.

The div Mentality

Most web pages are written in HTML or a variant of that. HTML has several different types of "tags", for example the paragraph you are reading right now is contained in a p tag, and the heading at the top of this page belongs to a h1 tag. These sorts of tags all have predefined default behaviors (these bahaviors are why almost all links in basic web pages are blue) that are easily understood and easily modified through CSS. The div tag however has no real predefined behavior, the div tag is really a tag for whatever custom purposes a developer wants to give it. Common practical uses of the div tag are to format custom headers and footers, but they can be used for anything really.

When I first started trying to put together a navigation bar for this site the approach I was using was to write a custom div, and have more custom divs inside that div making a big messy div sandwich. When I decided to look up a better way to do it i found that all I needed to do was do some small modifications on tags I already knew how to use. At first I didn't believe it was that simple and I spent more time fidling with my code that wouldn't ever work. But eventually I decided to try out doing it the easy way, it of course didn't turn out how I had originally imagined but after some thought I realized that it was better than I had imagined because adding new links and taking them away wouldn't require me to go back and change the behavior of everything else and I didn't have to define seperate behaviors for different devices. I would have never gotten that god of a result with whatever I was trying to write.

I've decided that the div mentality, as I've decided to call it, is the idea that creating something new requires some complex custom solution or some tool you don't have, and the idea stems from being unfamiliar with the tools that are at your disposal. Of course there are some times when a custom solution or a new tool is neccecary, but those are not as often as you make yourself believe. They say that a dedicated soul with noting but a monkey wrench can accomplish more than an unmotivated one with a garage full of tools.

In the long run you will save a lot of time by avoiding the div mentality.