Do classes such as "container" have inherent characteristics or are they just names?

I’m working through one of the Web Design projects.

The example given for the project makes extensive use of the class “container” (as well as “grid” etc.):

https://codepen.io/freeCodeCamp/full/RKRbwL

Do these classes have inherent qualities? Or are they just names? In other words, does using “container” do anything or is it just a name? I see .container styled in the CSS. So I’m just wondering if “container” could be replaced with any name.

If “container” doesn’t carry any inherent importance, do any other classes do? Thanks

You can replace container with anything. Bootstrap uses it to contain elements, hence the name.
So if you have

.container {
 margin: auto; 
}

 /* This will do that same thing */
.notAContainer {
 margin: auto;
}

its just better practice to give classes a relevant name, so container would inherently tell me that you are using that class to contain some HTML.

1 Like

Hi @El_Escandalo, in this case you write all the HTML and CSS yourself so container is just a name and you can replace it with other name of your choice.

In CSS framework like Bootstrap(somebody wrote the CSS for you to use), class container do carries some CSS with it.

That’s my understanding, hope it helps!

1 Like

Like the others have said, a class of container usually means you’re dealing with bootstrap, which has added a bunch of CSS to manage objects within that container.

As for the other part of your question, no there are no “built-in” classes in HTML, i.e. names with special meanings. When HTML wants to define a new built-in behavior, they define new tags and CSS properties instead.

1 Like