Jump to content

html

virtual machine noob

im using html and css and trying to make an image banner for my website can anyone help with the code

 

Link to comment
Share on other sites

Link to post
Share on other sites

<a href="https://google.com" target="_blank" id="banner1"><img src="file.jpg"></a>

Basically you don't need css for that just replace the link (href) and image banner source (src).

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, SupaKomputa said:

<a href="https://google.com" target="_blank" id="banner1"><img src="file.jpg"></a>

Basically you don't need css for that just replace the link (href) and image banner source (src).

it doesnt seem to work

Link to comment
Share on other sites

Link to post
Share on other sites

Well it suppose to work. Have you entered the right file path?

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, SupaKomputa said:

Well it suppose to work. Have you entered the right file path?

this is what i put

 <a src="https://ibb.co/k8pJ1pv" target="_blank" id="banner1"><img src="file.jpg"></a>

Link to comment
Share on other sites

Link to post
Share on other sites

duh... well you should change the file.jpg to make it a banner.

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, SupaKomputa said:

duh... well you should change the file.jpg to make it a banner.

should i leave the start as google

 

Link to comment
Share on other sites

Link to post
Share on other sites

18 minutes ago, virtual machine noob said:

 <a src="https://ibb.co/k8pJ1pv" target="_blank" id="banner1"><img src="file.jpg"></a>

it should be :

 <a href="https://ibb.co/k8pJ1pv" target="_blank" id="banner1"><img src="this_is_the_link_for_the_IMAGE.jpg"></a>
 

This is Wrong, just copy my code and change the link (called href - Hypertext REFerence) and the file SouRCe (src).

HREF is the end point, example yoursite.com or google.com.

You must specify the address of the image otherwise it won't work.

Do you have the image uploaded already? Can you open it on the browser?

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

a is an anchor, it's an invisible element that let's you specify where the browser should go when user clicks on whatever is between the start of the a tag and the end.

 

<a href=" address browser goes to when user clicks on stuff inside this tag  "  >  stuff   </a>

 

now you have to put something visible on the screen, so you put an image .... that has the tag img  and you tell the browser what image should load with the src parameter.  Optionally, you can also add the alt parameters, which is a text shown by browser if for some reason the image fails to load or if the user disables loading pictures.

 

<img src=" link to the picture you want to load" alt="This is a descriptive text, optional" />

Because you can't have other stuff between <img> and </img>, you can use the short close tag, />  instead of having to say ></img>

 

So now you can put the image tag inside the anchor and you have your banner:

 

<a href="htts://linustechtips.com"><img src="https://i.imgur.com/nXbAWzV.jpg" alt="My Banner" /></a>

If the picture is on your server in the same location where the page is loaded from, you don't have to type the whole domain and path, you can just use file name . extension

If you want the browser to load it from a specific place on your server, you can type the path with a / at the start   example  <img src="/images/banner.jpg" alt="banner" /> <- browser will try to load your domain name / images / banner.jpg

 

 

Link to comment
Share on other sites

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

×