因此,我想在页面上居中放置一个消息表单,但我不知道为什么,它如何起作用。 我的html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Kapcsolat</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Quicksand">
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="index.html" class="navbar-brand">Sanyigarázs</a>
</div>
<div class="nav navbar-nav">
<li><a href="rolunk.html">Rólunk</a></li>
<li><a href="#">Kapcsolat</a></li>
<li><a href="weboldalrol.html">Weboldalról</a></li>
</div>
<!-- <form class="form-inline">
<input class="form-control mr-sm-2" type="search" placeholder="Ide írja keresését." aria-label="Keresés">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Keresés</button>
</form> -->
</div>
</nav>
<div>
<form id="uzenetes" action="emailtest.php" method="post">
<table border="0">
<tr>
<td>Név</td>
<td align="center"><input type="text" name="username"
size="20" maxlength="150" width="150"/></td>
</tr>
<tr>
<td>E-mail cím</td>
<td align="center"><input type="text" name="address"
size="20" maxlength="150" width="150"/></td>
</tr>
<tr>
<td>Tárgy</td>
<td align="center"><input type="text" name="subject"
size="20" maxlength="150"/></td>
</tr>
<tr>
<td>Üzenet</td>
<td><textarea id="message" name="message" placeholder="Ide írja üzenetét..." size="20" maxlength="150"></textarea></td>
</tr>
<td colspan="2" align="center"><input id="button" type="submit"
value="Elküldés"/></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
我的css是:
form {
margin: 0 auto;
width:250px;
margin-top: 15%;
}
和
body {
font-family: 'Quicksand', sans-serif;
}
.thumbnail {
transition: all 0.2s;
}
.thumbnail:hover {
transform: scale(1.1);
}
p {
text-align: center;
}
.jumbotron {
border: 1px solid black;
}
.tested {
font-size: 140%;
}
.bug {
padding: 15px;
border-top: 1px solid black;
}
.navbar-inverse {
transition: all 0.2s;
}
.navbar-inverse:hover {
transform: scale(1.1);
}
.weboldalroltext {
padding-bottom: 3px;
}
body {
padding-top: 70px;
}
.mainHeader {
padding-bottom: 50px;
}
.navbar {
padding-top: 5px;
font-size: 20px;
}
.navbar-brand {
font-size: 20px;
}
a:after {
display: block;
content: '';
border-bottom: solid 3px #fff;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
padding: 5px 0px 0px 0px;
}
a:hover:after {
transform: scaleX(1);
}
.helloka {
width: 300px;
font-size: 25px;
}
hr {
height: 10px;
border: 0;
box-shadow: inset 0 12px 12px -12px rgba(0, 0, 0, 0.5);
}
form {
padding-left: 80%;
padding-top: 10px;
width: 150%;
}
h5 {
font-size: 18px;
}
我在设计方面有点不好,所以如果我在CSS代码中做过糟糕的事情,请不要生气。 所以我想要的是将#uzenetes表单居中放在屏幕上。感谢您的帮助,克里斯托夫。
答案 0 :(得分:1)
从<div class="info">
<label for="input">Stream</label>
<input id="input" type="text" name="someNameHere" value="http://hi5.1980s.fm/;" />
<input id="sent" type="submit" value="Set" />
</div>
sent.addEventListener("click", function(evt) {
player.src = value.value;
player.volume = 1.0;
});
中删除width: 150%;
和padding-left: 80%;
。因为您已经在下面创建了第二个表单CSS。
form
form {
margin: 0 auto;
width:250px;
margin-top: 15%;
}
body {
font-family: 'Quicksand', sans-serif;
}
.thumbnail {
transition: all 0.2s;
}
.thumbnail:hover {
transform: scale(1.1);
}
p {
text-align: center;
}
.jumbotron {
border: 1px solid black;
}
.tested {
font-size: 140%;
}
.bug {
padding: 15px;
border-top: 1px solid black;
}
.navbar-inverse {
transition: all 0.2s;
}
.navbar-inverse:hover {
transform: scale(1.1);
}
.weboldalroltext {
padding-bottom: 3px;
}
body {
padding-top: 70px;
}
.mainHeader {
padding-bottom: 50px;
}
.navbar {
padding-top: 5px;
font-size: 20px;
}
.navbar-brand {
font-size: 20px;
}
a:after {
display: block;
content: '';
border-bottom: solid 3px #fff;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
padding: 5px 0px 0px 0px;
}
a:hover:after {
transform: scaleX(1);
}
.helloka {
width: 300px;
font-size: 25px;
}
hr {
height: 10px;
border: 0;
box-shadow: inset 0 12px 12px -12px rgba(0, 0, 0, 0.5);
}
form {
padding-top: 10px;
}
h5 {
font-size: 18px;
}