我想在同一行显示<h1>
代码和button
代码,但button
略低于h1{
display:inline-block;
}
.log {
width:60%;
height: 30%;
position: absolute;
border: 1px solid #f9f2f2;
border-radius: 10px;
background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 0px solid #f9f2f2;
text-align: center;
line-height:20px;
border-width: 0px 0px 1px 1px;
}
。我在绿色标记我要显示它:
<div class="log">
<h1>Profile</h1>
<form method="post">
<button class="logout" name="logout" >Logout</button>
</form>
</div>
{{1}}
答案 0 :(得分:1)
我刚修改过这个:
form {
float: right;
display: inline-block;
margin-top: 20px;
}
h1 {
display: inline-block;
}
.log {
width: 60%;
height: 30%;
position: absolute;
border: 1px solid #f9f2f2;
border-radius: 10px;
background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 0px solid #f9f2f2;
text-align: center;
line-height: 20px;
border-width: 0px 0px 1px 1px;
}
form {
float: right;
display: inline-block;
margin-top: 20px;
}
&#13;
<div class="log">
<h1>Profile</h1>
<form method="post">
<button class="logout" name="logout">Logout</button>
</form>
</div>
<!--End of log div -->
&#13;
或者你可以用:
form{
display:inline;
}
答案 1 :(得分:0)
您有<h1>
代码的内嵌,现在您可以将内联插入form
代码中,如下所示:
<form method="post" style="display:inline">
<button class="logout" name="logout" >Logout</button>
</form>
答案 2 :(得分:0)
h1{
display:inline-block;
}
.log {
width:60%;
height: 30%;
position: absolute;
border: 1px solid #f9f2f2;
border-radius: 10px;
background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 0px solid #f9f2f2;
text-align: center;
line-height:20px;
border-width: 0px 0px 1px 1px;
}
form{
display:inline-block;
float:right;
margin-top:20px;
}
&#13;
<div class="log">
<h1>Profile</h1>
<form method="post">
<button class="logout" name="logout" >Logout</button>
</form>
</div>
&#13;