Html 位置:相对位置;中断网页中的css不透明度
添加Html 位置:相对位置;中断网页中的css不透明度,html,css,Html,Css,添加位置时:相对对于代码,背景弹出窗口不会有任何不透明度-这是什么原因?我不明白为什么居中的网页会影响背景的不透明度 谢谢所有能帮忙的人 <html> <head> <style> body { background-color: white; width: 960px; margin: auto; position: relative; } .one { background: black; -webkit-border-radius: 12; -moz
位置时:相对代码>对于代码,背景弹出窗口不会有任何不透明度-这是什么原因?我不明白为什么居中的网页会影响背景的不透明度
谢谢所有能帮忙的人
<html>
<head>
<style>
body {
background-color: white;
width: 960px;
margin: auto;
position: relative;
}
.one {
background: black;
-webkit-border-radius: 12;
-moz-border-radius: 12;
border-radius: 12px;
font-family: Book Antiqua;
color: #ffffff;
font-size: 60px;
text-align: center;
width: 75px;
height: 75px;
overflow:hidden;
float:left;
position:absolute;
transition: .5s ease;
top: 120px;
left: 140px;
text-align: center;
text-vertical-align: middle;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.8);;
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
</style>
</head>
<body>
<a class="one" id="one" href="#popup1" onclick="changeZIndex(this)">1</a>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
1
</div>
</div>
</div>
</body>
</html>
身体{
背景色:白色;
宽度:960px;
保证金:自动;
位置:相对位置;
}
.一{
背景:黑色;
-webkit边界半径:12;
-莫兹边界半径:12;
边界半径:12px;
字体系列:古董书;
颜色:#ffffff;
字体大小:60px;
文本对齐:居中;
宽度:75px;
高度:75px;
溢出:隐藏;
浮动:左;
位置:绝对位置;
过渡:放松;
顶部:120px;
左:140像素;
文本对齐:居中;
文本垂直对齐:中间对齐;
}
.覆盖{
位置:绝对位置;
排名:0;
底部:0;
左:0;
右:0;
背景:rgba(0,0,0,0.8);;
过渡:不透明度500ms;
可见性:隐藏;
不透明度:0;
}
.覆盖:目标{
能见度:可见;
不透明度:1;
}
.弹出窗口{
利润率:70像素自动;
填充:20px;
背景:#fff;
边界半径:5px;
宽度:30%;
位置:相对位置;
过渡:所有5s易于输入输出;
}
.弹出窗口h2{
边际上限:0;
颜色:#333;
字体系列:Tahoma,Arial,无衬线;
}
.弹出.关闭{
位置:绝对位置;
顶部:20px;
右:30px;
过渡:所有200ms;
字体大小:30px;
字体大小:粗体;
文字装饰:无;
颜色:#333;
}
.弹出.关闭:悬停{
颜色:橙色;
}
.popup.content{
最高高度:30%;
溢出:自动;
}
我来了
1.
向html
和body
元素添加高度
CSS
CSS错误
.one
{
background: black;
-webkit-border-radius: 12;
-moz-border-radius: 12;
border-radius: 12px;
font-family: Book Antiqua;
color: #ffffff;
font-size: 60px;
text-align: center;
width: 75px;
height: 75px;
overflow: hidden;
float: left;
position: absolute;
transition: .5s ease;
top: 120px;
left: 140px;
text-align: center;
/* incorrect value
text-vertical-align: middle;
*/
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.8);
/*
transition: opacity 500ms;
*/
transition: opacity 0.5s;
visibility: hidden;
opacity: 0;
}
.one
{
background: black;
-webkit-border-radius: 12;
-moz-border-radius: 12;
border-radius: 12px;
font-family: Book Antiqua;
color: #ffffff;
font-size: 60px;
text-align: center;
width: 75px;
height: 75px;
overflow: hidden;
float: left;
position: absolute;
transition: .5s ease;
top: 120px;
left: 140px;
text-align: center;
/* incorrect value
text-vertical-align: middle;
*/
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.8);
/*
transition: opacity 500ms;
*/
transition: opacity 0.5s;
visibility: hidden;
opacity: 0;
}