Others

CSS Tips for beginner

May 9, 2023

In this blog I want to share some things and concepts about CSS which I think every front end developer should know.

Default CSS

Before writing CSS of any html tag a developer should become familiar with its default CSS. I have seen some developer overwriting the default behaviour of the html elements. For example:-

Giving display:block; to a div.

This is an example of useless CSS.It increases your CSS file, makes your CSS difficult to read and also the browser have use the same behaviour again for rendering.

Some other examples may include:

.container{

display:flex;

<p id="flex-direction:row;

justify-content:flex-start;

}

Browser editing of css

Never give width and height to elements.

Some of the freshers gives width and height to buttons, labels and divs. By giving width and height to such elements make your website unresponsive. The data may fit inside the elements but when your screen size decreases the CSS just breaks and makes your website pretty dirty. By giving width and height you are bounding the inner elemts to the respective width and height. So, if inner elements grow the outer container does not grow with it and the things starts to look messy.

Leave a Reply

Your email address will not be published. Required fields are marked *