我想添加一個按鈕到標題,但它沒有顯示;我認爲這是在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