css层
Posted liyiyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css层相关的知识,希望对你有一定的参考价值。
add.css
.overlay
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
.popup
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
z-index: 1000;
.popup label
display: block;
margin-bottom: 15px;
.popup label span
display: block;
font-weight: bold;
margin-bottom: 5px;
.popup input,
.popup select
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
.popup input[type="submit"]
background-color: #4CAF50;
color: #fff;
border: none;
padding: 10px 16px;
font-size: 16px;
cursor: pointer;
border-radius: 4px;
.popup textarea
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical; /* 允许垂直调整大小 */
min-height: 100px; /* 设置最小高度 */
#closebtn
position: absolute;
top: 10px;
right: 10px;
background-color: transparent;
border: none;
font-size: 20px;
color: #999;
cursor: pointer;
textarea
text-align: left;
white-space: pre-line;
width: 100%;
padding: 0px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
font-family: Arial, sans-serif;
font-size: 14px;
color: #333;
background-color: #f9f9f9;
margin: 0px;
textarea:focus
outline: none;
border-color: #666;
box-shadow: 0 0 4px rgba(102, 102, 102, 0.3);
browse.css
/* 页面样式 */
body
font-family: Arial, sans-serif;
background-color: #f4f4f4;
/* 表格样式 */
table
border-collapse: collapse;
width: 100%;
margin: 20px 0;
background-color: #fff;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
th, td
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
th
background-color: #3f3f3f;
color: #fff;
/* 输入框和按钮样式 */
input[type="text"]
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
margin-right: 10px;
button
padding: 8px 12px;
background-color: #3f3f3f;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
/* 开关按钮的样式 */
.switch
position: relative;
display: inline-block;
width: 60px;
height: 34px;
/* 开关按钮的input元素的样式 */
.switch input
opacity: 0;
width: 0;
height: 0;
/* 开关按钮的滑块的样式 */
.slider
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 34px;
/* 开关按钮的滑块的样式当选中时 */
.slider:before
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50%;
/* 开关按钮的input元素选中时的样式 */
input:checked + .slider
background-color: #2196F3;
/* 开关按钮的input元素选中时滑块的样式 */
input:checked + .slider:before
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
img
border-radius: 50%;
width: 100px;
height: 100px;
.button
display: inline-block;
padding: 0.5rem 1rem;
font-size: 10px;
font-weight: bold;
text-align: center;
text-transform: uppercase;
text-decoration: none;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 0.25rem;
cursor: pointer;
transition: background-color 0.3s ease;
.button:hover
background-color: #0062cc;
.delete,.reset
background-color: #dc3545;
.chose,.myStudent ,.myHomework,.myVideo
background-color: #0080ff;
.delete:hover,.reset:hover
background-color: #c82333;
.chose:hover,.myStudent:hover,.myHomework:hover,.myVideo:hover
background-color: #0080ff;
.Id
text-decoration: none;
color: #333;
position: relative;
display: inline-block;
.Id:before
content: "";
position: absolute;
bottom: -2px;
left: 0;
width: 100%;
height: 2px;
background-color: #ff6600;
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s ease-in-out;
.Id:hover:before
visibility: visible;
transform: scaleX(1);
.Id:hover
color: #ff6600;
font-weight: bold;
#lab
float: right;
margin-top: 10px;
#lab span
margin-right: 10px;
font-weight: bold;
color: #333;
#addlab
display: inline-block;
background-color: #007bff;
color: #fff;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
#addlab span
display: inline-block;
#addlab .plus
margin-left: 5px;
.addTea
background-color: #4CAF50; /* 设置背景颜色 */
border: none; /* 去除边框 */
color: white; /* 设置文字颜色 */
padding: 3px 5px; /* 设置内边距 */
text-align: center; /* 设置文字居中 */
text-decoration: none; /* 去除下划线 */
display: inline-block; /* 将按钮设为块级元素 */
font-size: 7px; /* 设置字体大小 */
margin: 4px 2px; /* 设置按钮之间的间距 */
cursor: pointer; /* 设置光标为手型 */
border-radius: 4px; /* 设置圆角 */
transition-duration: 0.4s; /* 设置过渡时间 */
.addTea:hover
background-color: #3e8e41; /* 设置鼠标悬停时的背景颜色 */
select.Tea
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
color: #333;
font-size: 14px;
width: 100px;
select.Tea option
padding: 5px;
.select-arrow
position: relative;
top: 1px;
right: 8px;
pointer-events: none;
border-style: solid;
border-width: 0.15em 0.15em 0 0;
content: \'\';
display: inline-block;
height: 0.45em;
vertical-align: middle;
width: 0.45em;
transform: rotate(45deg);
transition: all 0.3s ease-in-out;
.select-arrow::before
position: absolute;
top: -0.3em;
right: -0.3em;
pointer-events: none;
border-style: solid;
border-width: 0.15em 0.15em 0 0;
content: \'\';
display: inline-block;
height: 0.45em;
vertical-align: middle;
width: 0.45em;
transform: rotate(90deg);
transition: all 0.3s ease-in-out;
select.Tea:focus,
select.Tea:hover
outline: none;
border-color: #999;
.select-arrow:hover
transform: rotate(135deg);
.select-arrow:hover::before
transform: rotate(225deg);
browseHomework.css
#addlab
display: inline-block;
background-color: #007bff;
color: #fff;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
#addlab span
display: inline-block;
#addlab .plus
margin-left: 5px;
body
font-family: Arial, sans-serif;
background-color: #f5f5f5;
.homework-container
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
margin-top: 20px;
width: 100%;
height: 100%;
.homework-item
flex: 0 0 15%; /* 控制每行显示的视频项数量,这里设置为每行显示4个 */
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 10px;
padding: 10px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: transform 0.2s ease-in-out;
.homework-item:hover
transform: scale(1.02);
.homework-item img
width: 100%;
height: auto;
border-radius: 4px;
.homework-item p
margin-top: 10px;
font-size: 16px;
font-weight: bold;
color: #333;
.homework-item span
font-size: 30px;
color: #888;
.delete-button
width: 40px;
height: 40px;
background-color: #ff5252;
border: none;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: background-color 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
.delete-button i
color: #fff;
font-size: 20px;
.delete-button:hover
background-color: #ff0000;
.a
display: inline-block;
padding: 10px;
border-radius: 4px;
text-decoration: none;
color: #333;
transition: background-color 0.3s ease;
.a:hover
background-color: #ffffff;
#sp1 input[type="radio"]
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid blue;
#sp2 input[type="radio"]
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid gray;
#sp3 input[type="radio"]
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid green;
#homeworkLab1 input[type="radio"]:checked
background-color: blue;
#homeworkLab1 input[type="radio"][value="1"]:checked
background-color: gray;
#homeworkLab1 input[type="radio"][value="1"]:checked + span
color: gray;
#homeworkLab1 input[type="radio"][value="2"]:checked
background-color: green;
#homeworkLab1 input[type="radio"][value="2"]:checked + span
color: green;
#homeworkLab2 input[type="radio"]:checked
background-color: blue;
#homeworkLab2 input[type="radio"][value="1"]:checked
background-color: gray;
#homeworkLab2 input[type="radio"][value="1"]:checked + span
color: gray;
#homeworkLab2 input[type="radio"][value="2"]:checked
background-color: green;
#homeworkLab2 input[type="radio"][value="2"]:checked + span
color: green;
#sp1
color: blue;
#sp2
color: gray;
#sp3
color: green;
browseVideo.css
#addlab
display: inline-block;
background-color: #007bff;
color: #fff;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
#addlab span
display: inline-block;
#addlab .plus
margin-left: 5px;
body
font-family: Arial, sans-serif;
background-color: #f5f5f5;
.video-container
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: flex-start;
margin-top: 20px;
width: 100%;
height: 100%;
.video-item
flex: 0 0 25%; /* 控制每行显示的视频项数量,这里设置为每行显示4个 */
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 10px;
padding: 10px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: transform 0.2s ease-in-out;
.video-item:hover
transform: scale(1.02);
.video-item img
width: 100%;
height: auto;
border-radius: 4px;
.video-item p
margin-top: 10px;
font-size: 16px;
font-weight: bold;
color: #333;
.video-item span
font-size: 14px;
color: #888;
.delete-button
width: 40px;
height: 40px;
background-color: #ff5252;
border: none;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: background-color 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
.delete-button i
color: #fff;
font-size: 20px;
.delete-button:hover
background-color: #ff0000;
.a
display: inline-block;
padding: 10px;
border-radius: 4px;
text-decoration: none;
color: #333;
transition: background-color 0.3s ease;
.a:hover
background-color: #ffffff;
#lab
display: flex;
align-items: center;
justify-content: right;
background-color: #f2f2f2;
padding: 10px;
border-radius: 5px;
#lab span
margin-right: 10px;
font-weight: bold;
#condition
padding: 5px;
border: 1px solid #ccc;
border-radius: 3px;
#find,#find1
padding: 5px 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
#find:hover,#find1:hover
background-color: #45a049;
changePwd.css
body
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-image: url("https://starry-lixu.oss-cn-hangzhou.aliyuncs.com/202209141908599.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
form
margin: 20px auto;
max-width: 400px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
label
display: block;
margin-bottom: 10px;
font-weight: bold;
input[type="password"]
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
input[type="submit"]
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
input[type="submit"]:hover
background-color: #0056b3;
input[type="submit"]:focus
outline: none;
detail.css
body
font-family: Arial, sans-serif;
background-image: linear-gradient(to bottom, #e0eaf1, #f5f5f5);
padding: 20px;
box-sizing: border-box;
header
text-align: center;
margin-bottom: 30px;
h1
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
table
width: 100%;
border-collapse: collapse;
margin-top: 30px;
th, td,input
padding: 10px;
border: 1px solid #ccc;
text-align: center;
th
font-weight: bold;
background-color: #f2f2f2;
.active
color: green;
.inactive
color: red;
img
border-radius: 50%;
width: 100px;
height: 100px;
function.css
@charset "utf-8";
/* CSS Document */
body
font-family: "Lato", sans-serif;
transition: background-color .5s;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-image: url("https://picsum.photos/1920/1080");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
#openbtn
font-size: 30px;
cursor: pointer;
background: linear-gradient(45deg, #ff00ff, #00ffff);
border: none;
color: #fff;
padding: 10px 20px;
border-radius: 20px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
transform: perspective(100px) rotateX(10deg);
#openbtn:hover
transform: perspective(100px) rotateX(0deg) scale(1.1);
box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.3);
/*侧边栏选择器*/
.sidenav
height: 100%;
width: 0; /*原始宽度*/
position: fixed;
/*z-index、top、left共同控制侧栏的悬浮(上方1,下方-1)*/
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s; /*侧栏延迟0.5s显示*/
padding-top: 60px;
/*侧边栏标签选择器*/
.sidenav a
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s; /*标签延迟0.3s显示*/
/*侧栏标签和关闭按钮光标的效果*/
.sidenav a:hover, .offcanvas a:focus
color: #f1f1f1;
/*侧栏和关闭按钮的位置选择器*/
.sidenav .closebtn
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
/*主体内容*/
#main
transition: margin-left .5s;/*主体内容延迟0.5s整体y右移动*/
padding: 16px;
/*当文档高度小于450px时,改变侧栏的padding属性和字体大小*/
@media screen and (max-height: 450px)
.sidenav padding-top: 15px;
.sidenav a font-size: 18px;
.user-info
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
float: right;
.user-info img
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 10px;
.user-name
font-size: 24px;
cursor: pointer;
color: #8c00ff;
-webkit-text-stroke: 2px #00ffff;
header
text-align: center;
margin-top: 50px;
h1
font-size: 48px;
cursor: pointer;
background: linear-gradient(45deg, #ff00ff, #00ffff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
section iframe
display: block;
width: 70%;
height: 800px;
margin: 20px auto;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border-radius: 2px;
object-fit: cover;
aside
position: absolute;
left: 0;
top: 5%;
background-color: rgba(255, 255, 255, 0.49);
padding: 20px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
border-radius: 5px;
homeworkDetail.css
body
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
.homework
max-width: 800px;
margin: 20px auto;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border: 2px solid lightblue; /* 添加这一行 */
background-color: lightblue; /* 添加这一行 */
.homework h1
color: #333;
font-size: 24px;
text-align: center;
.homework p
color: #666;
font-size: 16px;
line-height: 1.5;
.homework img
display: block;
max-width: 100%;
height: auto;
margin: 10px auto;
.answer-container
max-width: 800px;
margin: 20px auto;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border: 2px solid lightblue;
background-color: lightblue;
.answer-container h1
color: #333;
font-size: 24px;
text-align: center;
.answer-item
display: flex;
align-items: center;
margin-bottom: 20px;
flex-wrap: wrap;
flex-direction: column;
background-color: white;
border: 2px solid rgba(255, 255, 255, 0.49);
.avatar
width: 80px;
height: 80px;
border-radius: 50%;
margin-right: 20px;
border: 2px solid gray;
.stuAnswer
width: 300px;
height: auto;
margin: 0 auto;
.an_score
display: flex;
align-items: center;
justify-content: space-between;
width: 300px;
margin: 10px auto;
.an_score input[type="text"]
border: 1px solid black;
padding: 5px;
.an_score input[type="submit"]
border: none;
border-radius: 20px;
background-color: #0080ff;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
login.css
body
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
@keyframes gradient
0%
background-position: 0% 50%;
50%
background-position: 100% 50%;
100%
background-position: 0% 50%;
form
background-image: url("../img/login.jpg");
background-size: cover;
padding: 20px;
border: 1px solid #ccc;
margin: auto;
width: 40%;
height: 20%;
padding: 20px;
border-radius: 5px;
h1
text-align: center;
font-size: 40pt;
font-family: Arial, Helvetica, sans-serif;
color: #333;
label
font-family: Arial, Helvetica, sans-serif;
font-size: 20pt;
color: #555;
input[type="text"], input[type="password"], select
display: block;
margin: 10px 0;
width: 100%;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
font-size: 20pt;
color: #333;
border: 1px solid #ccc;
border-radius: 5px;
input[type="submit"]
margin: 30px auto;
padding: 20px;
background-color: #4CAF50;
width: 100%;
color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 20pt;
border: none;
border-radius: 50px;
cursor: pointer;
input[type="submit"]:hover
background-color: #3e8e41;
#id, #pwd
width: 100%;
register.css
form
margin: auto;
width: 40%;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
background: white;
label
display: block;
margin: 10px 0;
font-weight: bold;
font-size: 15pt;
input[type="text"], input[type="password"], select, input[type="file"]
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
width: 100%;
box-sizing: border-box;
input[type="radio"]
margin-right: 10px;
input[type="submit"],input[type="button"]
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 50px;
cursor: pointer;
width: 100%;
margin-top: 20px;
input[type="submit"]:hover,input[type="button"]:hover
background-color: #3e8e41;
body
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
@keyframes gradient
0%
background-position: 0% 50%;
50%
background-position: 100% 50%;
100%
background-position: 0% 50%;
select
font-size: 15pt;
stuHomworkDetail.css
body
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
.homework,.myAnswer
max-width: 800px;
margin: 20px auto;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border: 2px solid lightblue; /* 添加这一行 */
background-color: lightblue; /* 添加这一行 */
.homework h1
color: #333;
font-size: 24px;
text-align: center;
.homework p
color: #666;
font-size: 16px;
line-height: 1.5;
.homework img
display: block;
max-width: 100%;
height: auto;
margin: 10px auto;
form
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
overflow: hidden;
form label
color: #333;
font-size: 16px;
form input[type="file"]
width: 300px;
height: auto;
border-radius: 5px;
border: none;
background-color: lightblue;
cursor: pointer;
form input[type="submit"]
width: 100px;
height: auto;
border-radius: 5px;
border: none;
background-color: lightgreen;
cursor: pointer;
videodetail.css
body
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
header
background-color: #333;
color: #fff;
padding: 20px;
text-align: left;
h1
margin: 0;
section
padding: 20px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
text-align: center;
div
display: flex;
align-items: flex-start;
justify-content: flex-start;
flex-direction: column;
video
width: 100%;
max-width: 600px;
height: auto;
span
font-size: 18px;
color: #888;
margin-top: 10px;
text-align: left;
p
font-size: 16px;
color: #333;
margin-top: 10px;
text-align: left;
css 问题 如何使子层背景覆盖父层背景
css 问题 如何使子层背景覆盖父层背景
<div style="background:url(catalog/view/theme/yaprak/image/ic.png); height:39px; width:960px;">
<div style="background:url(catalog/view/theme/yaprak/image/sol.png); height:39px; height:39px; width:10px "></div>
<div>
只要子div设置的背景,就会覆盖掉父div的本回答被提问者采纳 参考技术B 子层的背景会自动覆盖父层的背景的,你最后一个div少了斜杠/ 参考技术C 子层CSS样式设置z-index:1;父层z-index:0; 参考技术D 不用设z-index 这样就可以,
以上是关于css层的主要内容,如果未能解决你的问题,请参考以下文章