• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS BACKground image and back- color

Saumyojit

Coder
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css">
</head>

<body style="background-color:lightblue;">

</body>
</html>


CSS:
body
  {


background-image:url("pass.jpeg"),url("skin.jfif");

  


    background-repeat: no-repeat,no-repeat;

    /* any background image will start from the top left corner of the element targeted*/

  background-size: 100% 50%, 100% 100%;

  /* setting the width and height of both the images */
  }


will the inline css over ride external css or external css will over ride ?
but i know that inline css specificity is higher

Screenshot (232).png


Why the background image is showing?? (see at the top)
 

Mangini

New Coder
will the inline css over ride external css or external css will over ride ?
but i know that inline css specificity is higher
Inline CSS almost always overwrites stylesheet CSS.

Why the background image is showing?? (see at the top)
Because background-color and background-image do two different things and can both be applied at the same time. If you were to use:

CSS:
<body style="background:lightblue;">

You will not see the background image anymore.

-----

Also, please stop tagging me in your threads.
 

Saumyojit

Coder
Inline CSS almost always overwrites stylesheet CSS.


Because background-color and background-image do two different things and can both be applied at the same time. If you were to use:

CSS:
<body style="background:lightblue;">

You will not see the background image anymore.

-----

Also, please stop tagging me in your threads.
no thats not happening .
bakc color and back image are both there . see the pic carefully.
 
Top