Clickable image
My image AG25.jpg is inserted in a page.:
<a href="images/AG2025.php"> <img src="images/AG25.jpg"...
I would like that by clicking on it, another page AG2025.php opens,
But I'm getting lost in the tags. Help!!!
alain
3 answers
-
Good evening
While waiting for a professional, refer to the Target tag from memory.
-
Hello,
If I understood your question correctly, you just need to adapt this skeleton:
<a target="_blank" href="https://www.google.fr"> <img src="image.jpg"/> </a>
Explanations:
- The img tag allows you to embed an image (the path is indicated by src). Ideally, you should avoid using more than one; all style attributes should be defined as much as possible in the site's stylesheet (css file).
- Only the a tag allows you to create a hyperlink. Therefore, you need to nest the img tag within the a tag.
- The href attribute indicates the target address (URL);
- The target="_blank" attribute is optional and means the target URL should be opened in a new tab.
Advanced explanations: Here, I wrote in XHTML, meaning "strict" HTML.
- An XML file consists of a nesting of tags. A tag can only close when all the sub-tags it contains are closed.
- A tag x is written starting with <x> (opening tag) and ending with </x> (closing tag), where x is a string of letters. Between these two tags, other tags, text, etc., can be inserted.
- When a tag contains nothing, it can be written in shorthand as <x/>. This is always the case for an image (img tag).
- You could write <img ...></img>.
- To abbreviate, you would write <img/> instead.
- You could write <img> but in that case, the file is no longer XML (and therefore no longer XHTML): it becomes "just" HTML.
- The a tag must "envelope" the entire image, thus we cannot abbreviate this tag.
- You could perfectly wrap something other than the image in this link (for example, text).
Good luck
-
Hello as well,
"Neither hello, nor me"... You're not very polite.
Polite phrases are essential on the CCM Forum when you write... https://www.commentcamarche.net/infos/25855-charte-d-utilisation-de-commentcamarche-net-respect-d-autrui/#politesse
Thank you for adhering to this.