html - 按此顺序显示 .div 或图像
问题描述
如何按此顺序定位某些内容。这就是我想要实现的
这就是我现在所拥有的
有人可以向我解释我如何很好地有序地向上移动吗?
<div class="middle">
<div id="middletop">
<img style="padding-left: 5px;padding-top:6px;" src="img/slider.png"/>
<a href="" class="downloadbutton" title="Pobierz grę"></a>
<a href="" class="signbutton" title="Zarejestruj się"></a>
<div class="channels">
<img src="img/status.png"/></br>
<img src="img/status.png"/></br>
<img src="img/status.png"/></br>
<img src="img/status.png"/>
</div>
</div>
</div>
CSS 代码
.middle
{
background: url('../img/middlebg.png') no-repeat center;
width: 1009px;
margin-top: 370px;
margin-left: auto;
margin-right: auto;
height: 1536px;
position: relative;
}
#middletop {
display: absolute;
}
.downloadbutton {
background: url('../img/download.png') top no-repeat;
width: 198px;
height: 67px;
display: inline-block;
}.downloadbutton:hover {
background: url('../img/download_hover.png') top no-repeat;
}
.signbutton {
background: url('../img/sign.png') top no-repeat;
width: 122px;
height: 67px;
display: inline-block;
}
.signbutton:hover {
background: url('../img/sign_hover.png') top no-repeat;
}
.channels {
}
解决方案
根据您给我们的示例,我能够创建一个易于使用和(希望)理解的布局。
布局
我使用表格来创建网格。这样您就不必考虑位置的使用,因为网格内的每个元素都会自动放置。
<body>
<table>
<tr>
<td class="container">
<div id="slider">Slider</div>
</td>
<td class="container">
<table>
<tr>
<td>
<button id="button1">button1</button>
</td>
<td>
<button id="button2">button2</button>
</td>
</tr>
<tr>
<td colspan="2">
<input placeholder="something1" />
</td>
</tr>
<tr>
<td colspan="2">
<input placeholder="something2" />
</td>
</tr>
<tr>
<td colspan="2">
<input placeholder="something3" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
造型
table {
border-collapse: collapse;
width: 100%;
border: none;
}
td, tr {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
table,
td, tr {
border: none;
}
td {
text-align: center;
}
.container {
width: 50%;
}
#slider {
width: 90%;
height: 150px;
border: 1px solid black;
}
input {
width: 90%;
}
推荐阅读
- javascript - JavaScript 文件不影响通过 jquery load() 方法导入的新文件
- sql - 日期时间的日期修剪
- vba - 尝试复制值时对象“_Worksheet”的错误 1004“范围”失败(明确设置工作簿和工作表,没有命名范围)
- react-native - 如何在本机反应中从父级访问子组件值?
- python - 从 date 和 datetime 中减去 Python timezone delta 会给出不同的日期
- c# - log4net - 增强以在每一行中自动包含另一个字段
- node.js - 节点中文档对象的替代
- java - Swagger 不适用于 Spring REST API
- sql - sqlite:数学运算不返回数字,即使单元格是真实的
- python - Python:Append-Function 添加多个值