- Joined
- Oct 18, 2009
- Messages
- 914
- Reaction score
- 335
Is it possible to make text have borders around them in css or html? For example I have black color text, and the border or outline is blue for the text. Hope I make sense. Thanks.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Stroked text</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="js.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<p id="text">My text goes here</p>
<script type="text/javascript" charset="utf-8">
makeStroke('#text', '#FF00FF');
</script>
</body>
</html>
p {
position: relative;
font-size: 29px;
}
span.rawtext { position:absolute; top:0px; left:0px;}
span.stroke1 { position:absolute; top:-1px; left:-1px;}
span.stroke2 { position:absolute; top:1px; left:1px;}
span.stroke3 { position:absolute; top:-1px; left:1px;}
span.stroke4 { position:absolute; top:1px; left:-1px;}
span.stroke5 { position:absolute; top:2px; left:0px;}
span.stroke6 { position:absolute; top:-2px; left:0px;}
span.stroke7 { position:absolute; top:0px; left:2px;}
span.stroke8 { position:absolute; top:0px; left:-2px;}
function makeStroke(obj, color){
var a = $(obj).html();
$(obj).html('');
for (i=1; i<=8; i++){
$('<span class="stroke'+i+'">'+a+'</span>').appendTo($(obj));
$('span.stroke'+i).css('color',color)
}
$('<span class="rawtext">'+ a + '</span>').appendTo($(obj));
}
-webkit-text-stroke
maybe because you don't have jquery![]()
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>