The power that technology has on us, is incredibly impossible to believe, and we don’t understand yet, how technology is manipulating the world, tremendously, but we will soon find out, the rules, which technology is using to be playing in this life, which we all are a part of.
If you want to become a professional in technology, in particular doing website and developing applications, you’d have to embark on a long journey, which only the fearless are able to take.
In today’s article we are going to talk about, CSS3 in particularly IDs and class names, to understand cascading styles sheets better
An excellent foundation is provided by meaningful elements, and the list of available elements, is not exhaustive in website development.
The purpose of (X) HTML was to be a simple document markup language, but as technology progressed and continue to change, HTML5 contains many resources, which helps the designer work with the code better; therefore, becoming part of the language interface, of application or website development.
Existing elements are given extra meaning, with the addition of an ID or a class name, which adds structure, to your HTML document
When you use IDs and classes in your HTML document, you will be provided with hooks, for your styles, and be able to control the style of several pages simultaneously, by changing one document, called the Cascading Style Sheet, or better known as the CSS document.
You could create your own custom navigation element, by taking a simple list of links, and giving it an ID name such as: navMain.
- first item
- second item
- third item
If you would like to identify an individual element, on a page, such as the site navigation, an ID, which must be unique, can be used on this case.
Persistent structural elements, such as the main navigation, or content areas, are identified, by the use of IDs.
In order to avoid confusion, ID names, across the site, must be applied to conceptually, similar elements
You will be able to avoid problems, when you want to style two similar elements, based on their context.
The use of distinct ID names, would make it much simpler, to style two contact forms, of the same elements, but different ID names, such as contactForms, and contactDetails.
One single ID can be applied to one element on the page; however, the same class, can be applied to any number of elements on the same page
Types of content or similar items, can be identified using a class, such as dates on several news stories, which are the same on each page, a class, would be applied to identify these dates, because they would be styled the same as well.
Classes become very powerful, because they allow you to style several elements, at the same times, but you won’t have the ability to target elements, as you would do, with IDs.
Try to use meaningful names, when you are naming your IDs and classes as well, it will help you in your development.
Try to name your IDs and classes, with names, that explains, what the element is, rather than how it is presented.
Thank you for reading this article!!!