Jump to content
Killersites Community
Sign in to follow this  
cristi

CSS stylesheet not working properly

Recommended Posts

Hello everybody!

I use  > background: url("images/background-forum.jpg"); < inside the body of the css stylesheet, but no background image is added, but when I do this in HTML > <body background="images/background-forum.jpg"> < it works, 

the structure.css is in the same folder as index.html and the one with all the images called " images ".

I use sublime text 3, someone can help me out?

Share this post


Link to post
Share on other sites
59 minutes ago, cristi said:

<body background="images/background-forum.jpg">

The above is not CSS. 

The reason the CSS is not working, is simply small errors in your code. Just Google 'CSS background image', and you are sure find many examples.

Stef

Share this post


Link to post
Share on other sites

I mean that with HTML code it works on the index file, the problem is when I try to set a background image from a stylesheet (img 1), it doesn't. The path seems ok to me (img 2).

 

1.PNG

2.PNG

Share this post


Link to post
Share on other sites

your style sheet should not have this syntax: 

 

<style>
  
</style>

 

just do it like this:

 

body
	{
	background: url("images/background-forum.jpg");
	}

and include it in your html head:

 

<link href="pathTo/style.css" media="all" rel="stylesheet" type="text/css">

 

 

  • Like 1

Share this post


Link to post
Share on other sites
55 minutes ago, DavidCampbell said:

your style sheet should not have this syntax: 

 


<style>
  
</style>

 

just do it like this:

 


body
	{
	background: url("images/background-forum.jpg");
	}

and include it in your html head:

 


<link href="pathTo/style.css" media="all" rel="stylesheet" type="text/css">

 

 

Thanks, after all it was the <style> included in the stylesheet, like you said.

Solved.

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×