如何在 css 中使形状居中
How to centre a shape in css
我正在临时创建一个网站屏幕 "coming soon page"。我在一些文字后面有一个圆圈。无论浏览器的大小如何 window,文本似乎始终位于页面中心,但圆圈似乎在不同大小上移动位置。有没有办法让圆圈完全在文字后面?
作为代码新手,我遵循了一些教程,但 none 似乎有效
这是有问题的网站:http://unixcast.com/
body{
margin: 0px;
padding: 0px;
background-color: #19181D;
}
.circle{
height: 400px;
width: 400px;
border-radius: 50%;
background: linear-gradient(#313247 0%,#19181D 30%);
position: absolute;
top: 20%;
left: 35%;
}
.circle:before,
.cirlce:after{
content: '';
height: 400px;
width: 400px;
background: linear-gradient(#FF849D 0%,#FF849D 5%, #2D2133 25%);
border-radius: 50%;
position: absolute;
top: 42%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-filter:blur(7px);
z-index: -1;
}
.cirlce:after{
width: 415px;
top: 35%;
-webkit-filter:blur(14px);
opacity: .3;
}
.unixcast{
font-family: sans-serif;
font-size: 40px;
color: white;
letter-spacing: 20px;
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%)
}
.msg{
font-family: sans-serif;
font-size: 20px;
color: white;
letter-spacing: 20px;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span class="circle"></span>
<span class="unixcast"> UNIXCAST </span>
<span class="msg">IS COMING SOON!</span>
<span class="notifymsg"> GET NOTIFIED WHEN IT'S READY</span>
<span class="field">
<input type="email" name="ENTER YOUR EMAIL"/>
<button>NOTIFY ME</button>
</span>
</body>
</html>>
我希望看到文字后面的圆圈,但它似乎会随着屏幕尺寸的不同而移动 windows
请写这个css给你圈class
.circle {
height: 400px;
width: 400px;
border-radius: 50%;
background: linear-gradient(#313247 0%,#19181D 30%);
position: absolute;
left: 0px;
right: 0px;
margin: auto;
top: 0px;
bottom: 0px;
}
我正在临时创建一个网站屏幕 "coming soon page"。我在一些文字后面有一个圆圈。无论浏览器的大小如何 window,文本似乎始终位于页面中心,但圆圈似乎在不同大小上移动位置。有没有办法让圆圈完全在文字后面?
作为代码新手,我遵循了一些教程,但 none 似乎有效
这是有问题的网站:http://unixcast.com/
body{
margin: 0px;
padding: 0px;
background-color: #19181D;
}
.circle{
height: 400px;
width: 400px;
border-radius: 50%;
background: linear-gradient(#313247 0%,#19181D 30%);
position: absolute;
top: 20%;
left: 35%;
}
.circle:before,
.cirlce:after{
content: '';
height: 400px;
width: 400px;
background: linear-gradient(#FF849D 0%,#FF849D 5%, #2D2133 25%);
border-radius: 50%;
position: absolute;
top: 42%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-filter:blur(7px);
z-index: -1;
}
.cirlce:after{
width: 415px;
top: 35%;
-webkit-filter:blur(14px);
opacity: .3;
}
.unixcast{
font-family: sans-serif;
font-size: 40px;
color: white;
letter-spacing: 20px;
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%)
}
.msg{
font-family: sans-serif;
font-size: 20px;
color: white;
letter-spacing: 20px;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<span class="circle"></span>
<span class="unixcast"> UNIXCAST </span>
<span class="msg">IS COMING SOON!</span>
<span class="notifymsg"> GET NOTIFIED WHEN IT'S READY</span>
<span class="field">
<input type="email" name="ENTER YOUR EMAIL"/>
<button>NOTIFY ME</button>
</span>
</body>
</html>>
我希望看到文字后面的圆圈,但它似乎会随着屏幕尺寸的不同而移动 windows
请写这个css给你圈class
.circle {
height: 400px;
width: 400px;
border-radius: 50%;
background: linear-gradient(#313247 0%,#19181D 30%);
position: absolute;
left: 0px;
right: 0px;
margin: auto;
top: 0px;
bottom: 0px;
}