[英]How do I position button to the bottom right using css
當我嘗試將按鈕放置在左下角時,它起作用了,但是當我轉到其中一個按鈕並返回時,那里只有一個按鈕了? 另一個我需要向下滾動才能看到,請幫助
的HTML
<!Doctype html>
<html>
<head>
<title>Forsaken </title>
<link href="main.css" rel="stlesheet" type="text/css">
</head>
<body>
<a href="teams.html"><button><img class="#topleft" src="icon1.jpg " width="100%" alt="Teams" ></button></a>
<a href="store.html"><button><img class="#topright" src="icon2.jpg " width="100%" alt="store" ></button></a>
<a href="sponsors.html"><button><img class="#bottomleft" src="icon4.jpg " width="100%" alt="sponsors" ></button></a>
<a href="aboutus.html"><button><img class="#bottomright" src="icon3.jpg " width="100%" alt="aboutus" ></button></a>
</body>
</html>
的CSS
#topleft {
position: fixed;
top: 0px;
left: 0px;
}
#topright {
position: fixed;
top: 0px;
right: 0px;
}
#left {
position: fixed;
left: 0px;
}
#right {
position: fixed;
right: 0px;
}
div {
border-style:solid;
border-width:0px;
border-color:#000000;
}
#yes {
border: none;
padding: 0;
background: none;
}
.flat {
border: none;
background: #222;
color: #FFF;
padding: 0px 0px;
font-size: 22px;
font-family: Palatino;
font-weight: bold;
}
.lighter {
background: #666;
}
#no {
border: none;
padding: 0;
background: none;
}
.flat {
border: none;
background: #222;
color: #FFF;
padding: 0px 0px;
font-size: 22px;
font-family: Palatino;
font-weight: bold;
}
.lighter {
background: #666;
}
ps除“關於我們”以外,所有其他按鈕均有效。
.topLeft{ position: absolute; top:0; left:0; } .topRight{ position: absolute; top:0; right: 0; } .bottomLeft{ position: absolute; bottom: 0; left: 0; } .bottomRight{ position: absolute; bottom: 0; right:0; }
<button class="topLeft"><a href="#">Click Me</a></button> <button class="topRight"><a href="#">Click Me</a></button> <button class="bottomLeft"><a href="#">Click Me</a></button> <button class="bottomRight"><a href="#">Click Me</a></button>
不要在類聲明中使用井號,這是不好的做法(井號用於捕獲id)。
這就是為什么您的代碼無法正常工作的原因。
如有任何問題,請回復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.