我想添加一个按钮到标题,但它没有显示;我认为这是在div下。为什么?我试图改变绝对位置,但没有任何工作。为什么我的<input type =“submit”>不显示?
.large-header {
position: relative;
width: 100%;
background: #333;
overflow: hidden;
background-size: cover;
background-position: center center;
z-index: 1;
}
.demo-1 .large-header {
background-image: url('../img/demo-1-bg.jpg');
}
.main-title {
position: absolute;
margin: 0;
padding: 0;
color: #f9f1e9;
text-align: center;
top: 50%;
left: 50%;
-webkit-transform: translate3d(-50%,-50%,0);
transform: translate3d(-50%,-50%,0);
}
.homebtn {
position:absolute;
-webkit-border-radius: 4;
-moz-border-radius: 4;
border-radius: 4px;
font-family: Arial;
color: #ffffff;
font-size: 41px;
background: #f0712c;
padding: 10px 20px 10px 20px;
text-decoration: none;
}
.homebtn:hover {
background: #f25e0e;
text-decoration: none;
}
<div class="container demo-1">
<div class="content">
<div id="large-header" class="large-header">
<canvas id="demo-canvas"></canvas>
<h1 class="main-title"><?php echo $home_page['header_title']; ?></h1>
<form action="../html-link.htm">
<input style="homebtn" type="submit" value="This is a button link">
</form>
</div>
</div>
</div>
HTML样式属性用于内嵌样式。尝试class ='homebtn'来引用你的外部风格。 – biagidp