Haw can i add a link to this code ?
<span style="background-color:#81d742;">Title</span>
this code is for a bottom in a website and i want it to have a link .
Thank you
You are allowed to put a tags inside span
<span style="background-color:#81d742;">Title</span>
Why would you need a <span>? You can just change the tag to a <a> tag:
<a style="background-color:#81d742;" href="http//mysite.com">Title</a>
You can simply do so by using anchor tag, i.e. a tag
For example, if you wish to link google.co, you can do so by following commands,
Google
Related
So I'm working on a website
<img src="Images/PaintEverythingPreview.png" herf="Pages/PaintEverything.html">
<p> - <a herf="Pages/PaintEverything.html">
Paint Everything
</a> - </p>
and the code here isn't working, none of the links work! I've coded a little program on my website, and this is supposed to take you to it, but it's not working, please help!
Use href instead of herf.
Paint Everything
HTML Tags
The correct way to include a link in your HTML is to use the href element (you mis-spelt it as herf.
Secondly, you cannot use href inside an img tag as it's not valid HTML. Instead, you should nest the img tag inside the link.
Update your code to this:
<a href="Pages/PaintEverything.html">
<img src="Images/PaintEverythingPreview.png">
</a>
<p>
Paint Everything
</p>
To validate (check) your HTML in the future, try the W3C Validator
error writing the attribute href.
Paint Everything
error in attribute href in img tag (not exists):
<img src="Images/PaintEverythingPreview.png" herf="Pages/PaintEverything.html">
html tag reference: HTML tags list
Change herf to href and enclose the img in <a> tags to make the image a clickable link.
<img src="Images/PaintEverythingPreview.png">
Firstly you need to remove href from the image tag, since you cannot put a href in an <img> tag.
Secondly you need to check if the path/link to which you want to redirect to, is correct or not.
I have updated your code and let me know if this is what you are looking for.
<img src="Images/PaintEverythingPreview.png"><p> - Paint Everything - </p>
I wrote this code
here
How I can make icon as picture instead of here .
I want when I run this code appears as icon when I click on this icon direct me to trans.php .
enclose an image tag within the <a> tag.
like,
<a href='trans.php'><img src='pic.jpg'/></a>
Use image <img src="" alt="" /> as icon
or
try to implement and use Font Awesome Icons https://fortawesome.github.io/Font-Awesome/icons/
There is another way if you don't want to use image tag is glyphicons`
for example
this example is taken from bootstrap there is a file which contain icons u just need to add this in your file
</i>
I want to create a link that does NOTHING, it means that its a fake link
Im trying with onclick="mijava();return false;" but it scrolls up in the website
How can I do it?
javascript:
document.getElementById("nothing").addEventListener("click", function(event){
event.preventDefault()
});
html:
<a id="nothing" href="#">Link</a>
JSFiddle
"javascript:void(0)" to href attribute, the <a> tag will do nothing.
This won't do anything.
Link
Do you test it that?
link
You can use CSS to style it like a link and you probably don't want to use an anchor tag if it's not going to act like one.
See this answer: How to make an anchor tag refer to nothing?
I`ve seen on various websites, some links appear like this: http://www.myserver.com/page.html#something and when I click on it, it just moves to another portion of the page.
I want to know how to do this. Is it only the URL of the <a href> atrribute?
The fragment at the end of the url coresponds to an ID on the page you're visiting.
If in my page I have a section such as:
<div id="comments">
...
</div>
Then I can take the user to this section by attaching #comments to the pages URL
(http://www.example.com/page.html#comments)
Link to comments
Update
Some of the other answers here correctly point out that you can create an anchor with a name attribute as: <a name="example"></a>.
Although this is technically correct, it's also a very antiquated way of doing things and something I'd recommend you avoid. It's very 1997 as some might say :-)
The text after the hashtag corresponts with an anchor on the page. An anchor is a hidden element on the page which you can link to.
Think for example about a large page with an to top link in it
To create an anchor use:
<a name="C4"></a>
To link to it use: Text
Or you can even link to an id of an element
Check out: links (aka anchors)
Also note that you can use <a name="something"></a> or <a id="something"></a>
or using divs <div id="something"></div>
This is a link to a bookmark on the given page (or even just #something on the current page).
To make it work, you need to define something. You can do this using the name attribute of an <a> tag.
http://programming.top54u.com/post/HTML-Anchor-Bookmark-Tag-Links.aspx
I have added an img tag inside title attribute,but the img tag shows as text when hover over link(using hovertip js),and does not display an image.What needs to be done?
<a title="4r23r 2342.00 <img src=/m/productsmedia/IHALE.GIF>" class="product_detail " href="/?product=6" id="0">4r23r</a>
You cannot! You need to use custom tooltip look-a-like effect with IMG insdie DIV and on mouseHover event.
Here is an example.
This is not possible in HTML, at least not what you appear to be attempting.
If you want a clickable image, you put the img tag inside the a tag, not inside an attribute:
<a title="4r23r 2342.00" class="product_detail " href="/?product=6" id="0">
<img src="/m/productsmedia/IHALE.GIF" />
</a>
If you want a tooltip that contains an image, you need to code it using javascript and css. There are plenty of articles describing how to achieve this.