WordPress started in 2003 with a single bit of code to enhance the typography, But these days WordPress rules the Internet. more and more users are opting for it and
making use of its fantastic themes to revamp the overall look and feel
of their website. However, as more and more themes are sprung up,
developers are looking for more creative ways to tweak them to suit
their website needs.
Developers need to work with stylesheets to
give their website a well-refined appearance. In a nutshell, they need
to play around theme’s CSS file to make changes in the design
aesthetics. But, while doing so, developers often commit some errors
that can make their theme function in a rag-tag manner. These mistakes
can badly impact the user experience and visual appeal of a website. In
this post, I am going to highlight 5 common mistakes the developers make
whenever they write CSS for their theme.
Let’s discuss about all of them in detail :
Not Understanding The Correct Way of Placing Files
Adding Unnecessary Code
.some-title { font-weight: bold; }
.some-other-title { font-weight: bold; color: red }
Instead of this, we can combine these lines just like this:.some-title,.some-other-title{font-weight:bold;}
.some-other-title{color:red;}
There
is a better way to do this, we can give these lines a common name and
also use modifier class to give the title a unique appearance.
Or, we can go for Sass@ extend. Sass is useful because it gives us reliable ways to give our selectors different names and also arrange them using comma-separated combos. This way there is absolutely no need for us to remember thier exact location. Look at the following example, to understand my point.
My title
Or, we can go for Sass@ extend. Sass is useful because it gives us reliable ways to give our selectors different names and also arrange them using comma-separated combos. This way there is absolutely no need for us to remember thier exact location. Look at the following example, to understand my point.
.some-title { font-weight: bold; }
.some-other-title { @extend .some-title; color: red; }
The following will be the output of the conversion from .scss to .css performed by preprocessors.
.some-title, .some-other-title { font-weight: bold; }
.some-other-title { color: red; }
- The result might not be drastically different from the what you could have got using that error-filled techique. But this would definitely save your time in placing different components and shorten CSS codes, so that you can go on with your modifications in a clear manner.
Working on a Wrong Template Module
Forgetting Details about CSS
Multiple Choices
0 comments:
Post a Comment