People are habituated to using css for all small and big size web applications development. Does any one thinking while writing css classes in capable of being used again. We need to consider the future maintenance of the web site while introducing any new css class. While writing the css we need to follow some standards and easy understandable.
when we are writing new class for blue background color the class name should say "bluebg" or "blue-background". But i strongly suggest to use simple names for classes and should me meaningful.
There are better ways to apply the css styles for elements like div,span,table,etc..
In our exmaple my client wants to show the heading in red color with fontsize 20px.
In general people will write one single class for headings this is fine if its a small applications. If we write the css classes like below which we can use anywhere in the applications.
.font20{
font-size: 20px;
}
.redcolor{
color: #C71585;
}
This is how we apply the style to element <
div class="font20 redcolor">
My Heading<
/div>
In the above example i have applied two css styles to element by giving a space between the class names. If we start using the above example we can reduce the effort in future when some one want to change the all headings to some other color.
Please do send your inputs if you have any better solution
No comments:
Post a Comment