How do I style a span to look like a link without using javascript?
css, html
Solution
span {
cursor:pointer;
color:blue;
text-decoration:underline;
}
<a href="#">Hyperlink</a><br />
<span>Span</span>
Additionally, you can use `:hover` pseudo-class to style the element when hovered (you can use any styles not just the ones originally used). For example:
span:hover {
text-decoration:none;
text-shadow: 1px 1px 1px #555;
}
Problem
For my website I will need to use `<span>` instead of `<a>`, because I am using mostly ajax and thus instead of links I have onclick ajax events as attributes in my spans. As a result, I had to manually style the spans to look like links. I have used hover and visited pseudo classes to change background and text colour, but to change the mouse default to a pointer finger on hover, will I need to use javascript? Or can I do that using css? Also, I have just realized: I could not just use the `<a>` tag anyways instead of `<span>`, but just instead of an href, I would include an onclick? It should work just the same, no?