建立HTML文件
响应式表格设计CSDN相关课程
课程序号 课程名称 课程操作 15004 Android开发实战 修改删除 15005 IOS开发实战 修改删除 15006 java开发实战 修改删除 15007 Ruby开发实战 修改删除 15008 HTML开发实战 修改删除
效果如下
配置CSS3样式
body{ margin: 0; padding:0;}/* 绿色 #35B558 橙色 #ff5c00 深灰 #666666 浅灰 #F8F8F8 * */h1{ text-align: center; font-size: 30px; color: #666;}.responsive a{ text-decoration: none; padding: 5px; color: #ff5c00;}.responsive{ width: 98%; margin: 0 auto; color: #000; border-collapse: collapse; border:1px solid #666666; box-shadow: 0 0 0 1px rgba(0,0,0,0.4);}.responsive th{ background-color: #35B558;}.responsive th,.responsive td{ border: 1px solid #666666; padding: 10px;}.responsive .number,.responsive .actions{ text-align: center;}
效果:
响应式配置
/*响应式配置*/@media (max-width: 480px) { /*去掉边框和阴影*/ .responsive{ border: none; box-shadow: none; } /*去掉表头*/ .responsive thead{ display: none; } /*把各项设置为块元素分布*/ .responsive tr,.responsive td{ display: block; } /*设置number和name距离,使用子选择器*/ .responsive td:nth-child(1), .responsive td:nth-child(2){ padding-left: 25%; } /*使用伪元素添加表头*/ .responsive td:nth-child(1)::before{ content: "课程序号"; position: absolute; left: .5em; font-weight: bold; } .responsive td:nth-child(2)::before{ content: "课程名称"; position: absolute; left: .5em; font-weight: bold; } /*给表头添加框和阴影*/ .responsive tr{ position: relative; border: 1px solid #666666; box-shadow: 0 0 0 3px rgba(0,0,0,.4); } /*给表头部分添加背景色*/ .responsive .number{ text-align: left; background-color: #35B558; } .responsive td.actions{ position: absolute; right: 0; top:0; border: none; }}响应式图片布局
这个很简单,就是不同分辨率下显示不同的图片,就直接把图片分享上来了,不写了
查看更多关于CSS3响应式表格和响应式图片_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did110760