javascript - 我可以在页面上画一条线吗?

标签 javascript html css line

因此,我正在尝试构建某种图表,并且我正在尝试在 div 顶部绘制多条线,但不会移动它。我想要这样的东西:

enter image description here

我目前的脚本基本上是这样的:http://jsfiddle.net/geekongirl/sguhyuv6/1/

<!--html--><div id="flowsheet">
    <div class="flowsheet-title">
         <h2>This is the title</h2>

    </div>
    <div class="flowsheet-content">
        <div style="text-align: center;">
            <div class="flowsheet-cell">Row 1, Box 1
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <div class="flowsheet-cell">Row 1, Box 2
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <br />
            <div class="flowsheet-cell">Row 2, Box 1
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <div class="flowsheet-cell">Row 2, Box 2
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <br />
            <div class="flowsheet-cell">Row 3, Box 1
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <div class="flowsheet-cell">Row 3, Box 2
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <br />
            <div class="flowsheet-cell">Row 4, Box 1
                <div class="flowsheet-description">Here is the description box</div>
            </div>
            <div class="flowsheet-cell">Row 4, Box 2
                <div class="flowsheet-description">Here is the description box</div>
            </div>
        </div>
    </div>
</div>

CSS:

#flowsheet {
    background-color: #f5f5f5;
    position: relative;
    width: 250px;
    height: 300px;
    border-radius: 25px;
    box-shadow: 10px 10px 5px;
}
.flowsheet-title {
    text-align: center;
    height: 20px;
    margin: 10px auto 30px auto;
}
/*individual cells*/
 .flowsheet-content {
    margin-left: auto;
    margin-right: auto;
    text-align:center;
}
.flowsheet-cell {
    display:inline-block;
    background-color: #ffffff;
    color: #000000;
    text-align: center;
    font-size:10px;
    margin: 10px 10px 15px 10px;
    padding: 10px;
    border-radius: 5px 5px 5px 5px;
    border: 1px solid black;
}
.flowsheet-cell:hover {
    background-color: #b5b5b5;
}
/*mousover descriptions*/
 .flowsheet-cell .flowsheet-description {
    display: none;
}
.flowsheet-cell:hover .flowsheet-description {
    background:#ffffff;
    position:absolute;
    display:block;
    border:1px solid #000;
    border-radius: 5px;
    font-size:12px;
    width: 185px;
    padding:5px
}

我可以画一条线,也可以画一条路径来取代盒子。我也尝试使用 hr 标签,但它隐藏在第一个 div 后面。有什么方法可以使用 Java 脚本设置多行吗? 谢谢!

最佳答案

使用z-indexposition

http://jsfiddle.net/sguhyuv6/3/

您可以通过更好地利用 css selectors 来大量清理该代码

关于javascript - 我可以在页面上画一条线吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31301049/

相关文章:

javascript - 从 ASP.NET 1.1 转换为 ASP.Net 3.5 后,单选按钮停止工作

javascript - 获取数组的长度 - 打印错误的值

html - 应用 CSS @media 时 iPhone 和 iPad 上的不可见布局

html - 组合 CSS 语法

javascript - 有没有办法用 jquery 改变一个类的属性?

javascript - 如何在将 "default open program"设置为 Atom 的文件中使可见的编辑器 Logo 图标作为预览?

html - Clearfix 小组不在 UL 中工作

javascript - JQuery 父 id 选择

javascript - window.alert() 在打包的应用程序中不可用

php - 单击单个图像的不同部分以触发 jquery 事件(基本上在单击时显示文本)