基本上這就是代碼。
鋼性鑄鐵
*{
margin:0;
padding:0;
font-family:sans-serif;
background-size:cover;
}
.login-box{
width:280px;
position:absolute;
top:50%;
left:50%;
transform :translate(-50%,-50%);
color:white;
}
.login-box h1{
float:left;
font-size:40px;
border-bottom: 6px solid;
}
超文本標記語言
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Transparent Login Form</title>
<link rel="stylesheet" href="style2.css">
</head>
<body>
<div class="login-box">
<h1>Login</h1>
<div class="textbox">
<input type="text" placeholder="Username" name="" value="">
</div>
<div class="textbox">
<input type="password" placeholder="Password" name="" value="">
</div>
<input class="btn" type="button" name="" value="Sign in">
</div>
</body>
</html>
知道h1為什么不接受CSS嗎?
我不明白為什么這里使用浮動。不就是為了把圖片和文字對齊嗎
鏈接到我學這個的視頻https://www.youtube.com/watch?OOC 6 f1 w6 mzg & amp;t = 54s秒
CSS正在工作,如果它在您的瀏覽器中不工作,請重新加載或重啟服務器
* {
margin: 0;
padding: 0;
font-family: sans-serif;
background: url(smoky.jpg) no-repeat;
background-size: cover;
}
.login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
h1 {
float: left;
font-size: 40px;
color: red;
border-bottom: 6px solid;
}
檢查這一行,樣式表鏈接正確
link rel = & quot樣式表& quothref = & quotstyle 2 . CSS & quot;
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: url(smoky.jpg) no-repeat;
background-size: cover;
}
.login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: black;
}
.login-box > h1 {
float: left;
font-size: 40px;
border-bottom: 6px solid;
color: brown;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Static Template</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-box">
<h1>Login</h1>
<div class="textbox">
<input type="text" placeholder="Username" name="" value="">
</div>
<div class="textbox">
<input type="password" placeholder="Password" name="" value="">
</div>
<input class="btn" type="button" name="" value="Sign in">
</div>
</body>
</html>
body{
margin:0;
padding:0;
font-family:sans-serif;
background: url(smoky.jpg) no-repeat;
background-size:cover;
}
.login-box{
width:280px;
position:absolute;
top:50%;
left:50%;
transform :translate(-50%,-50%);
color:white;
}
.login-box ,h1{
float:left;
font-size:40px;
border-bottom: 6px solid;
}
hello sir here we should use the coma "," for the middle of login-box and the h1 tag
下一篇vue上傳視頻失敗