我需要绘制大量精确定位的水平箭头,指向左侧,右侧或两者。我不想使用HTML画布。它将全部使用JQuery动态完成,但css参数与以下大致相同,包括箭头大小和箭头粗细。CSS创建与箭头主体对齐的箭头
此代码工作得很好......
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style >
.ArrowHead {
position: absolute;
width: 0;
height: 0;
border-top: 4px solid transparent;
border-bottom: 5px solid transparent;
border-right: 12px solid black;
top:46px;left:52px;
}
.Arrow {
border-top:solid 1px black;
position: absolute;
top:50px;left:50px;
width:100px;height:1px
}
</style>
</head>
<body>
<div id="Arrow" class="Arrow"></div>
<div id="ArrowHead" class="ArrowHead"></div>
</body>
</html>
...但箭头的尖端稍微箭头的身体之上,它只是看起来的右侧正确对齐因为箭头的底部比顶部大(在400%时更容易看到)。但是,我很希望知道是否有某种方式使箭头可以垂直对称,并且仍然与箭头体完全水平地排列在一起。
你有一个打印屏幕?也许你需要根据箭头指向的位置更改保证金顶部。 – Medda86
http://jsfiddle.net/sgUnw/ –
http://www.thepixelweb.com/creating-arrows-using-css/ –