cristi Posted January 11, 2019 Report Share Posted January 11, 2019 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? Quote Link to comment Share on other sites More sharing options...
administrator Posted January 11, 2019 Report Share Posted January 11, 2019 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 Quote Link to comment Share on other sites More sharing options...
cristi Posted January 11, 2019 Author Report Share Posted January 11, 2019 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). Quote Link to comment Share on other sites More sharing options...
DavidCampbell Posted January 12, 2019 Report Share Posted January 12, 2019 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"> 1 Quote Link to comment Share on other sites More sharing options...
cristi Posted January 12, 2019 Author Report Share Posted January 12, 2019 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. 2 Quote Link to comment Share on other sites More sharing options...
administrator Posted January 12, 2019 Report Share Posted January 12, 2019 Cool! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.