Need help putting a background image in html and css - html

I've been trying to put a background image on a website using html and css, I've watched youtube videos but it never works for me. I was wondering if anyone could help point out what I've been doing wrong. Thank you!
Tried putting an image as a background for a website but whenever I save and reload the website it never appears and is just blank.
I forgot to add the speech marks thing here, but even when I added it, it still never worked

You can try this code
With proper path.

update the path to
background-image: url(../ronaldo.jpg);
go through this article for a better understanding of using path absolute-vs-relative-paths

You have the wrong path. Your image is not in the same folder as your css file. Put a correct path, try this: background-image: url(../ronaldo.jpg);.
If it still doesn't work, tru putting the path in between of " " like this:
background-image: url("../ronaldo.jpg");

Try typing in "/" in the url brackets and the intelisense should appear.
It should give you all possible images in your folder.

Related

How can I find the correct image path in CSS?

I am trying to access the first picture in the img folder but I can't seem to get the right file directory. I've tried it with ../img/model-1.jpg, with /img/mode1-1.jpg, and without the img. I've tried the to copy the path as well but nothing seems to work. I don't know if I'm doing it wrong or is it a glitch.
I found out the problem. I was using background-image and it was only focusing on the url and the other text probably cancelled it out. I used background and the link path worked fine. Thanks for all of your help!

Why won't my image display despite correct src address? [html]

i'm new to html and css and i've decided to utilise my time spent commuting by doing a little coding on the go. As such, i've started a practice project using Droidedit for android, on my Galaxy S7, but now i've hit a bit of a head-scratcher. Attached images below:
With full URL code and result with full URL
With relative URL code and result with relative URL
Not sure where i've gone wrong here. The image is in the same directory as the html file.
Thanks in advance peeps!
You don't need that last "/" at the end after the jpg
I guess there could be an issue with path used to show the image. Instead of following
<img src="internal storage/download/htmlearning/jotpage1.jpg/" ...
try
<img src="jotpage1.jpg" ...
since your HTML file and image file are at same folder

How do we add an image that's not from google?

How do we add an image that's not from google? It's a picture I took myself on my mobile phone and emailed it to my computer.
When making a website. Just put all your files in 1 folder. You can have subfolders. When wanting to link an image just put it somewhere in that folder and then just use the path to it.
So you need to do is provide a source for the pictures to display.
you would do
Just make sure to reference where the picture is comming from, if its in the same location as your html this will work. If its in a folder then you need to specify
here is a good reference, W3 Schools will help you alot here
http://www.w3schools.com/html/html_images.asp
One of the site's rules is:
Don't ask about questions you haven't tried to find an answer for (show your work!).
I guess this is the reason why you got those minuses.
Read here: http://www.w3schools.com/html/html_images.asp about how to add images to HTML code.
A solution for your problem could be:
<img src="myimage.jpg">, if we add images from HTML code.
background-image: url(myimagee.jpg);, if we add images from CSS code.

Background image taken from another domain

I am trying to put a code that takes my background image in an html file from another domain.
Here is an HTML snippet where I try to pull in from an external URL:
<div style="background-image: url(http://anotherdomain.com/images/bgimage_1.png)"></div>
But this is not working. I know that I should normally write this in a CSS file and put a relative path, but I haven't done that yet. Does anyone know if this is possible?
I found a problem, it is working when i add quotes
background-image: url('http://anotherdomain.com/images/bgimage_1.png');
Even if W3C says that quotes are optional, in this case they are mandatory.

Joomla Background Image?

I'm sure there is a very simple explanation for this but... How do I add a background image to my Joomla site? I am using a modified version of Atomic. The obvious thing to do would be to simply go into the template.css file and add a background-image property to my body or divs... however, it doesn't take. If I change the background color however that works fine. Perhaps the path is incorrect but I've tried it a hundred times and I doubt I'd get the path wrong every time. I've even tried placing the image file in the root folder, thus eliminating the possible mistyped path to the file.
Any ideas?
Thanks.
Editing the template CSS file is definitely the way to do it. This should help -
Folder to put image in:
JOOMLA FOLDER/templates/atomic/images
CSS to use:
#ID.class{background:URL(../images/background.png);}
If that doesn't work, post a link so we can debug for you.