Using unnecessary coding in css

I had created two div and giving margin to both div like- 1st div (margin:20px;)and 2nd div(margin:20 px;)

Hello there.

Do you have a question?

The more information you give us, the more likely we are to be able to help.

1 Like

I give margin-bottom:20px to my 1st div and margin-top:20px to my 2nd div this is wrong code ?

Could you provide a link to the project?

It is hard to tell what the issue is without some context.

Are you working on one of the FCC challenges?
If so, then it would help to link the challenge you are working on.

are you asking if it is wrong because you are writing the same rule twice?

to avoid that you can give a class to each div and style the class

yes i think this is wrong , i am writing code twice

You could try something like this.
https://codepen.io/jdwilkin4/full/abmPoVj

The blue and red boxes are your code and the green and black boxes are my code.

exactly ! thankyou so much for help

1 Like