Div class in css style sheet and how it works in theme

div class code image

Div class is a container. This specific code is for indicating parts of theme. For example, you can separate your header tags from your footer tag using it. It is mainly for css. Moreover, you can create and edit styles of your theme in your style sheet with it. Div class and id are not the same. However, id has more power than class. For example, if you use both of them, then the active form will be the id.

Say, you are using two formats for your header. One of them is div class header. On the other hand, you specify the other format with id. In that case, the id style will be visible instead div class codes. Else, you will get it working properly in your custom theme.

A professional wordpress theme can contain more than one format. Also, you can use the same format again and again. However, it is not recommended to do that. That is because, you will face difficulties changing parts of your content. For example, you are using the same div class name article in multiple sections. Now, you want to change one of them. Let’s name that part as part two. Therefore, you will be changing codes in that section. Suddenly you will experience that, it will change all the parts where you used the same divide format.

Here is a live example. James Watson has two parts on his body tag for writing articles. One of them is left part, which is article section. So, the next part is sidebar section. Again, he named both of those parts with div id article. Now, he wants to change the sidebar design. So, he applied changes for the same. Suddenly, the same changes are taking place on both section instead of sidebar.