Forum Moderators: not2easy
.thing:after {content:attr(title);}
[edited by: alt131 at 12:19 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]
a[href]:after {
content: ">> " attr(myatt);
display: block;
padding: 20px;
background: #eee;
color: #000;
font: 12px/1.5 monospace;
}
<a href="http://example.com" title="Example Site for Widgets" myatt="Visit this site">Visit this site</a>
content: contents; but after a quick scan I'm not sure I understand the use case apart from moving content.. i.e. you can put it, the content, into a "pending" state then "insert" it somewhere else in the document, i.e. it moves it - it won't apply the content twice. This is all theory at the minute because I can't find a browser that supports it anyway so am unable to "see it" ;) - TBH can't think of a use case for duplicating content :after the content anyway.. which may not be helping my answer here.. :) [edited by: alt131 at 12:20 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]
[edited by: alt131 at 12:21 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]
<a>email me</a> at <a>contact@site.com</a>
<!doctype html>
<html>
<head>
<title>intelligent hover effects example</title>
<style type='text/css'>
a {color:red; text-decoration:none;}
a.hover {text-decoration:underline;}
</style>
</head>
<body>
You can <a href='mailto:me'>contact me</a>
at <a href='mailto:me'>my email</a>, not
<a href='mailto:you'>this email</a>.
<script type='text/javascript'>
var links=document.getElementsByTagName('a');
function linkhover() {
for(var i=0;i<links.length;i++)
if(links[i].href==this.href)
links[i].className='hover';
}
function clearlinkhover() {
for(var i=0;i<links.length;i++)
if(links[i].href==this.href)
links[i].className='';
}
for(var i=0;i<links.length;i++) {
links[i].onmouseover=linkhover;
links[i].onmouseout=clearlinkhover;
}
</script>
</body>
</html>
[edited by: alt131 at 12:21 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]
I could also do this if there were a parent selector in css (the opposite of > ), but apparently there isn't.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Highlight Same Links</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><script src="http://code.jquery.com/jquery-1.4.4.js"></script><style type="text/css" media="screen">
#content a {text-decoration: none;}
#content a:hover,
#content a.hovered {/* make sure the added class name is included in the same CSS as the CSS hover */
color:red; text-decoration: underline;
}
</style>
</head>
<body>
<div id="content">
<p>You can <a href='mailto:me'>contact me here</a>, but not here <a href='mailto:you'>your email</a></p>
<p>You can't use <a href='mailto:you'>this email</a>, nor <a href='mailto:you'>that one</a>, but you could try <a href='mailto:me'>this one</a> too.</p>
</div>
<script>
$(function() {
$("#content a").hover(function() { // initiate the function when link is hovered on
var myVar = $(this).attr("href"); // put the href value into a variable
$("#content a[href="+myVar+"]").addClass("hovered"); // add the classname .hovered to all links with same href value as stored in variable
},
function () {
$("#content a").removeClass("hovered"); // remove added classes on mouse out
});
});
</script>
</body>
</html>
[edited by: alt131 at 12:22 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]
<span class='link'>Or you can <a
href='mailto:trash'>send your complaints</a> to <a
href='mailto:trash'>my priority inbox</a></span>
[edited by: alt131 at 12:24 am (utc) on May 17, 2011]
[edit reason] Side Scroll [/edit]