Combine Margin in CSS | Shorting Codes in CSS

                                    CSS Shorthand Guide

Hello Guys,

I hope you are doing good, today I’m going to tell you how to short css code, and work smart. Look at the above picture and try to understand the trick.. below I have stated the benefit and css code given…

Both div/ Box having same concept like:

(1) Both have center allign to the outer container.

(2) Both have margin:top 10px

(3) Both have margin:bottom 55px

But writing of css style is diffrent.

.divOne{
margin-top:10px;
margin-bottom:55px;
margin-left:auto;
margin-right:auto;
}

.divTwo{
margin:10px auto 55px;
}

Combine css Id and Class | Id And Class with Same Properties


How to combine class and ID in CSS selector?

Hi,

Hope you are doing good today i am telling you how to combine css id and css..

This is new way to define the same properties to the id and class. Like Here i do the same properties like: border, border radius, background-color and padding.
Synatx Method:  #idName,.className{“Your all Propery for both id and class will be here.;”}

  • Please consider no space between id and class in syntax
  • Use of comma between both id and class.

→ Click on this link view Example