如何构建一些带有标题和描述的基本磁贴?
How to build some basic tiles with Title and Description?
我想使用 HTML/CSS 构建一些基本图块,可能会利用 jQuery UI,因为我已经将其用于其他用途。
我正在寻找类似的东西,并正在寻找 HTML/direction 如何在网络浏览器中获取它。
也就是看下面的HTML
问题 HTML mark-up
- 描述没有浮到底部
- 添加后续方形 div 框(也称为 "tiles")不会将它们定位到前一个框的右侧
<div style="width:100px;height:100px;background-color:lightgrey;text-align:center">
<div style="">Module</div>
<div style="width:100px;height:20px;position:absolute">
<span style=""> description </span>
</div>
</div>
如果您只想要其中包含文本的基本方块,您可能需要这样的东西:
<html>
<head>
<style>
.square {
color:black;
border-style: solid;
border-width: 10px;
width: 200px;
height: 200px;
text-align: center;
}
</style>
</head>
<body>
<div class="square">
<h3>Module Name</h3>
<p>Module is used for this and that</p>
</div>
</body>
</html>
如果您需要将说明与单元格底部对齐,您可以查看 CSS vertical-align: text-bottom;
为了很好地对齐将出现在彼此右侧然后环绕成网格的块,我建议使用带有内联块的列表。 fiddle 例子在这里。 http://jsfiddle.net/89a07gm3/2
我的基本结果:
.square {
color: black;
border-style: solid;
border-width: 3px;
width: 250px;
height: 200px;
text-align: center;
list-style-type: none;
display: inline-block;
margin: 0px 50px 10px 20px;
position: relative;
}
.child {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
<div onclick="location.href='#';" style="cursor: pointer;" class="square">
<h1>Module Name</h1>
<p class="child">Module is used for this and that</p>
</div>
<div onclick="location.href='#';" style="cursor: pointer;" class="square">
<h1>Module Name</h1>
<p class="child">Module is used for this and that</p>
感谢 Beth + 评论者
我想使用 HTML/CSS 构建一些基本图块,可能会利用 jQuery UI,因为我已经将其用于其他用途。
我正在寻找类似的东西,并正在寻找 HTML/direction 如何在网络浏览器中获取它。
也就是看下面的HTML
问题 HTML mark-up
- 描述没有浮到底部
- 添加后续方形 div 框(也称为 "tiles")不会将它们定位到前一个框的右侧
<div style="width:100px;height:100px;background-color:lightgrey;text-align:center">
<div style="">Module</div>
<div style="width:100px;height:20px;position:absolute">
<span style=""> description </span>
</div>
</div>
如果您只想要其中包含文本的基本方块,您可能需要这样的东西:
<html>
<head>
<style>
.square {
color:black;
border-style: solid;
border-width: 10px;
width: 200px;
height: 200px;
text-align: center;
}
</style>
</head>
<body>
<div class="square">
<h3>Module Name</h3>
<p>Module is used for this and that</p>
</div>
</body>
</html>
如果您需要将说明与单元格底部对齐,您可以查看 CSS vertical-align: text-bottom;
为了很好地对齐将出现在彼此右侧然后环绕成网格的块,我建议使用带有内联块的列表。 fiddle 例子在这里。 http://jsfiddle.net/89a07gm3/2
我的基本结果:
.square {
color: black;
border-style: solid;
border-width: 3px;
width: 250px;
height: 200px;
text-align: center;
list-style-type: none;
display: inline-block;
margin: 0px 50px 10px 20px;
position: relative;
}
.child {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
<div onclick="location.href='#';" style="cursor: pointer;" class="square">
<h1>Module Name</h1>
<p class="child">Module is used for this and that</p>
</div>
<div onclick="location.href='#';" style="cursor: pointer;" class="square">
<h1>Module Name</h1>
<p class="child">Module is used for this and that</p>
感谢 Beth + 评论者