Jump to content

Recommended Posts

Posted

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?

Posted
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

Posted

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

Posted

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
Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...