Basic HTML question on class="left"

Hello, I am fairly new here!

I am currently working on the Wine Festival Schedule on the Introduction to HTML course.

(https://www.codecademy.com/courses/learn-html/projects/wine-festival-schedule?action=resume_content_item)

I don’t understand how the td class=“left” works. In the exercise we are asked to assign class to left for everything in the first column after the headers, it aligns it nicely in the centre with the headers. But I thought class=left would align all data in the first column to the left not in the centre. Can someone explain what the class=left code is doing?

Thanks :grinning:

3 Likes

Sadly I can’t access this course because I’m not a pro member.
class is an attribute for identifying things in HTML, in this case you need that to so CSS programming language will find it. CSS or Cascading Style Sheets is a programming language that you can make the web page more beautiful.
I would recommend to learn it after HTML. In this case they set the left class in CSS to make these designs(sorry but I don’t know what it does in this case because as I said i can’t access it)
Use classes when there are multiple things you need to design with CSS . And use Id-s when there is only one of something.
Hope this helps :grinning:

1 Like
.left {
  width: 150px;
}

This just makes the left-most column wider than the right one for the larger text.

1 Like

Correction, not a programming language since it has no logic. CSS is declarative. It consists of selector rulesets that contain all the property:value declarations that are to apply to any element with that selector.

There are three basic selectors, each of which can be considered as “hooks”: element type, class, and id. Type and class each have pseudo selectors. id does not because it is unique.

Notice how the field narrows from type to class to id? By combining type with class we narrow it down some more.

2 Likes