如何使列表生成的html表具有响应性
How to make html table made by list responsive?
我用ul li
制作了一个带有列表的表。这是我的html代码。
<div style="" class="first_calendar clendar-wrapper calendar-1">
<ul class="calendar ">
<li class="calen-title"><a href="#">Sunday <br>Mar 22</a></li>
<li class="" style="min-height:40px;"><a data-day="7" rel="21" href="#"> 6:00 am</a> </li>
<li class="" style="min-height:40px;"><a data-day="7" rel="22" href="#"> 6:15 am</a> </li>
</ul>
<ul class="calendar ">
<li class="calen-title"><a href="#">Monday <br>Mar 23</a></li>
<li class="" style="min-height:40px;"><a data-day="1" rel="21" href="#"> 6:00 am</a> </li>
<li class="" style="min-height:40px;"><a data-day="1" rel="22" href="#"> 6:15 am</a> </li>
</ul>
<ul class="calendar ">
<li class="calen-title"><a href="#">Tuesday <br>Mar 24</a></li>
<li class="" style="min-height:40px;"><a data-day="2" rel="21" href="#"> 6:00 am</a> </li>
<li class="" style="min-height:40px;"><a data-day="2" rel="22" href="#"> 6:15 am</a> </li>
</ul>
</div>
这是我的css代码。
.calendar{
margin: 0;
padding: 0;
/*width: 40px;*/
list-style: none;
float:left;
}
.clendar-wrapper{
/*float: left;*/
/*background-image: url("../img/table_bg.png");*/
background-position: 0 -58px;
/*float: left;*/
}
.clendar-wrapper{
display: none;
display: none;
width: 100%;
max-height:350px; overflow-x:hidden ; padding-bottom:10px;
}
.table-responsive {
width: 918px;
/*border:1px solid red;*/
background-color: #FFFFFF;
overflow: visible;
}
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
.clendar-wrapper{
width: 100%;
height:auto;
} /* your css rules for ipad portrait */
}
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape) {
.clendar-wrapper{
/*width: 100%;*/
height:auto;
} /* your css rules for ipad landscape */
}
.calendar-1{
display: block;
}
.prev-table{
display: none;
}
.login_register a {
color:white;
}
.calen-title {
background-color: #D9E8F4 !important;
}
.calen-title a{
font-size: 16px;
color: #222;
font-weight: bold;
}
.calendar li{
padding: 8px;
border: 1px solid #ddd;
}
.calendar li a {
color: #222;
font-size: 16px;
}
.calendar li:nth-child(2n+2) {
background-color: #f9f9f9;
}
.pagi_list .pre_btn, .pagi_list .nex_btn{
margin: 0px;
}
.last_link, .first_link {
font-size: 35px;
font-weight: bold;
line-height: 0;
position: relative;
top: 5px;
color:#d65c4f;
}
它是在引导程序上编码的。当我打开它的小分辨率设备列下拉。在这里我创建了一个演示链接点击这里打开。请告诉我如何使这个日历具有响应性。
提前谢谢。
使用媒体查询时,通常不明智的做法是设置设备的高度,而只设置宽度。设备的方向设置了宽度,因此如果您在纵向和横向之间切换,媒体查询仍然有效。
你可以使用100%但最大为700像素的日历包装器,这使得每天100像素的内容都能完美地融入其中,如果屏幕小于700像素,你可以将它们垂直排列。我在这里仅使用一个简单的媒体查询就抛出了一个示例>https://jsfiddle.net/pfg1dxfy/您将看到,通过抓取javascript窗口和结果窗口之间的条并调整其大小,表将根据宽度进行更改。
我还添加了一个简单的清晰修复,当浮动元素时需要这个。在CSS中,它是.clear{clear:both;},然后在的所有浮动元素之后包含它
.calendar{
margin: 0;
padding: 0;
list-style: none;
float:left;
width: 100px;
}
.clendar-wrapper{
width: 100%;
max-width: 700px;
margin: auto;
}
@media (max-width: 699px) {
.calendar{
width: 100%;
float: none;
margin: 30px 0;
}
}
相关文章:
- 如何在 JavaScript 和 HTML 中更改对输入框的提示响应
- http请求使用html而不是json进行响应
- jQuery/Ajax-试图通过Ajax创建POST方法并获得对HTML的响应
- 为什么不是't html<对象>元素响应鼠标事件
- 如何在jquery ajax成功html响应中找到输入隐藏元素
- 如何从php返回php变量值以及html响应ajax
- 如何使列表生成的html表具有响应性
- ajax成功响应后如何更改html类
- 尊重“; 〃;从HTML显示中的API响应返回的换行符(和特殊字符)
- AJAX 数据响应 - 如何解析 html
- 从 HTML 页面中的第三方响应数据中获取单个值
- 如何使用 HTML 图像请求将数据发送到服务器,或返回数据作为响应
- HTML中的JavaScript:对单选按钮的响应
- 从Ajax Arraybuffer响应类型创建HTML画布
- 从字符串中删除 HTML(在 JSON 响应中)
- 创建响应 html 表时出现的问题
- 加载 ajax 响应(html 内容数据)而不发生 css 冲突
- 如何在一个onclick函数中添加两个响应?html中的onclick是
- 响应HTML元素,使用jQuery更改DIV的背景和文本
- 用curl打开url,点击ajax按钮,等待并得到响应html