DEV Community

Cover image for Must know CSS code.
Waleedh Nihal
Waleedh Nihal

Posted on • Edited on

Must know CSS code.

  1. display:flex;

2.justify-content:center;

3.align-items:center;

4.background-image:url(./whatever-image-you-have);

5.background-repeat:no-repeat;

6.font-weight:bold;

7.background-size:cover;

Lets Go!

Top comments (2)

Collapse
 
lensco825 profile image
Lens

Great examples! You should also add background-size: cover since it makes sure the whole content of the backgroud image is visable. Here's a quick example i made:


Collapse
 
waleedh profile image
Waleedh Nihal

Ok thx