0

What is the use of content: "" in this code?

I am trying to make my background image transparent in css3 , using opacity. There is no direct way but this gets the job done. However i do not understand the use of content here.

body::after{
    content: "";
    background: url(image.jpg); 
    opacity: 0.4; 
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    position: fixed; 
    z-index: -1; 
}
RiddleMeThis
  • 1,345
  • 4
  • 16
  • 29

1 Answers1

0

You are using a Pseudo-Element.

If you added content: "123"; it would add that content into the page. If you left out content: ""; it would revert to default content: none; (actually default is normal which translates to none for content) which would mean there is nothing to style and everything else would be ignored.

Here is more info on generated content.

RiddleMeThis
  • 1,345
  • 4
  • 16
  • 29