CSS IDs vs Classes

I’ve recently been teaching myself HTML5 and CSS3. It’s actually pretty sweet – all of the new things that have come out for both areas. But while going over CSS I realized I didn’t really understand something – what is the difference between an ID and a Class in CSS?

For a while there I figured they were pretty much interchangeable, but that thought didn’t quite sit right with me. If and ID and Class are interchangeable then why have both available if they do the same thing in the CSS code? Well after coming to a decent stopping point in my book, I did what I usually do when I don’t know something – look it up on Google.

To my surprise I actually found the answer on page 1 and within the first 10 available links. (For once I didn’t have to search through the massive haystack that is Google for that 1 needle of an answer.) And here’s what I found out:

IDs and Classes are set up basically the same way in an HTML or CSS document, with the major differences showing up in the coding style used in CSS.

For IDs:
HTML setup

 <p id = “idexample”>This paragraph shows the CSS style for an ID.</p>

CSS Setup

 P#idexample
 { backgroundcolor: white; }

For a Class:
HTML setup

 <p class = “highlight”>This paragraph is highlighted using the CSS style for a class.</p>

CSS Setup

 p.highlight
 { color: green; font-weight: bold}

Nothing new here, right? Well the main difference aside from the CSs formatting is the usage of each. Basically you use an ID when you want something formatted as certain way ONLY ONCE on the page. So if you want a heading green, bold, uppercase and italicized only once, use an ID. (Best comparison – you are a single person with 1 ID card.)

A class is used when you want something formatted throughout the page more than once. Best place I can think to use a class would be to format the text in several paragraphs. (Best comparison – there are many people in a classroom.)

Usually you want to use an ID once on a page since they are considered unique. This doesn’t mean you only use an ID once ever on a page, but you use the name you set an ID to once. So, id=”heading1”, id=”paragraph heading”, id=”sentence style”, etc.

The next question I had was what happens if the IDs and Classes end up conflicting with each other for some weird reason. (I go code crazy sometimes so this happens to me on occasion.) The answer to this is an ID holds hierarchy over a Class, so an ID would be used.  It’s like the same method used when you have inline CSS code and a linked style sheet for the same HTML document.

So basically, use an ID for one occurrence and a class for several occurrences.

Sources:

http://www.tizag.com/cssT/cssid.php

http://css.maxdesign.com.au/selectutorial/advanced_idclass.htm

 

 

 

 

 

 

 

 

code practice, web design , , , ,

How To Create Data Viz aka the Infographic

Smashing Magazine has a great article on the creation of a data viz aka infographic (the ads or commentary consisting of a picture as the focus point for the message). I’ve wanted to make a few of these myself but didn’t really know where to start or what to include, so I have to say this article is the best place to start if you’re as clueless as I am. I’ll have to find some interesting stats and make some sketches. I have a feeling I’ll be inspired once I get started. ^_^

Source: Smashing Magazine

graphic design , , ,

WordPress Template Hierarchy

One of the things I usually have trouble with when working on a WordPress theme is figuring out how to edit the .php files and what is actually being edited. Well I recently found an article that breaks down the template hierarchy for a basic WordPress site. It has helped me greatly and I wanted to pass it on.

Your Road Map to  WordPress Template Hierarchy

web design, wordpress , ,

An Interesting Case

For those of you that don’t know, or didn’t notice the fine print in the footer, I created this site using WordPress, specifically a WordPress template. I originally had a portfolio site that I created completely in Dreamweaver using Lightbox 2 and links to view my work. I made it in about 3 days and needed to have something to show my work since I had just graduated from college at the time. The portfolio did work for a while since I was able to get two jobs using it, but I felt it was time to update the look a bit. I didn’t want to spend a lot of time designing something in Photoshop when all I was really looking for was web presence. So I was very excited when I found my current site as a freebie from Smashing Magazine. I had to do a bit of editing, but I finally have the site the way I wanted it to look. It wasn’t an easy task, especially since I’m still learning PHP, but I managed to get things working correctly.

But as I was looking at the article for this template, I noticed a few arguments in comments section. A few people feel that using WordPress as a portfolio site is a “cheap” version of web design and a web designer should design their own site. I don’t feel this way at all. There are a ton of awesome things I would love to do with a portfolio site of my own, but it doesn’t mean I know how to do it and make it work. There are also a ton of things I would like to learn how to do, but don’t have the time to figure them out to the level of proficiency of using them in a site. Also, my art skills are no where near what they used to be so drawing, inking, scanning and editing a picture in Photoshop is hours of time I may not want to devote to a simple or complex site.

So if I find a template that has all of the attributes I’m looking for with great art and working addons, I’m going to use it! Web designers aren’t gods. We sometimes design things from scratch using paper and pencil, but it takes FOREVER! I would rather use stock photography or Google image search to find the pictures I need and Photoshop them together with different filters if I needed to go that route. There is much more to WordPress than the simplicity of filling in some criteria for a post or page content area or uploading and inserting some type of media. If you need to edit the template, you need to know enough PHP to find what you’re looking for and the ability to fix something if the code breaks. The same goes for when you are making a WordPress theme, especially when coding the post and loops so they display correctly. I admire anyone that can make a WordPress template, no matter how simple or complex it is. And I do not fault anyone who wants to use a WordPress template for their web design portfolio.

It’s not the portfolio site that shows the skill but the content of the site. If you can do all the things you demonstrate in you portfolio examples, then that should be good enough for anyone. I’ve seen beautiful web sites with crappy portfolio pieces – it would look like the person didn’t care about their work and just wanted a pretty background. Which basically shows you can’t judge a book by its cover.

Does my site have some crappy pieces as part of my portfolio? I don’t doubt it. Do I let it bother me? Hell no! Why? Because I have room to develop as a designer and leave my past work up as a reminder of where I started and how far I have come.

So don’t fault me for my use of a WordPress template or anyone else who has gone the same route. Because I would love to see the person complaining recreate the same or a similar site in the 2 days it took me to finish my WordPress site. I doubt it could be done with the same amount of finesse.

web design

A Short Introduction

Hello everyone! My name is Danielle but you can call me Dani. A lot is already said about me in the front page header and the About Me section of the site, so I’ll try to add some more stuff I didn’t mention.

I’m interested in using my portfolio to show off my work progress as a designer in web design, graphic design, logo design, and anything else I can get a chance to work on. I’d like to work more with Visual Studio and do some database work in the future. I actually have a pretty good understanding of how to setup and maintain a database, even if they do drive me insane at times. But from what I’ve learned from others that have also designed databases, the insanity comes with the territory.

I would like to get back into 3d modeling using 3ds Max and Maya. I’ve heard Maya is a beast so I’ll probably save that for a later time, especially since I’ve already learned 3ds Max. My goal is to create objects and environments like you would see in a video game. I’ll let you guys know when I get started and post my progress as I work on things.

That’s about it for now. Feel free to browse the site and contact me with any questions or comments you may have.

Uncategorized