Reputation: 1
I'm working on a site for my class and I'm having extreme difficulties getting this header's image to show. They are in the same folder and I can get the image to show when applied directly to a specific page. I feel there is something wrong with the way my CSS is coded.
h1
{ background-color: #000033;
background-image: <img src="sunset.jpg" "Height=72px" <alt="Sunset"> ;
color: #FFFFFF;
line-height: 200% ;
font-family: Georgia, serif;
text-indent: ;
text-shadow: ;
margin-bottom: 0 ;}
so i got it to work without realizing it, here is the code i ended with.
h1
{ background-color: #000033;
background-image: url(sunset.jpg) ;
color: #FFFFFF;
line-height: 200% ;
font-family: Georgia, serif;
text-indent: ;
text-shadow: ;
background-position: right;
background-repeat: no-repeat;
height: 60px;
padding-left: 20px;
margin-bottom: 0 ;}
Upvotes: 0
Views: 700
Reputation: 1
You can't use HTML tags inside CSS.
Try this:
background-image:url ('sunset.jpg');
and it will work fine.
Upvotes: 0
Reputation: 484
background image is used in css as follows
background-image: url("sunset.jpg");
take a look https://www.w3schools.com/css/css_background.asp
Upvotes: 2
Reputation: 165
When using CSS, you don’t need to use HTML tags e.g. <img.../>
you just use the following:
h1
{ background-color: #000033;
background-image: url(“sunset.jpg");
color: #FFFFFF;
line-height: 200% ;
font-family: Georgia, serif;
text-indent: ;
text-shadow: ;
margin-bottom: 0 ;}
Upvotes: 0