我正在重建学校的学生内部网以进行评估,但遇到按钮问题。正如您在图像中看到的那样,在按钮链接之间的间隙中看到一条水平线。
这有什么原因吗?如果有帮助,我已经在网站的按钮部分附加了CSS和HTML代码。
CSS:
.button {
background-color:rgba(255, 255, 255, 0.5);
border:none;
width:auto;
height:auto;
border-radius:3px;
color:#ffffff;
font-size:16px;
cursor:pointer;
padding:15px;
z-index:3;
}
.button:hover {
color:#000000;
transition:.2s;
background-color:rgba(255, 255, 255, 0.8);
padding-left:18px;
padding-right:18px;
}
.button:active {
color:#000000;
}
.button:focus {
outline-color:gold;
}
HTML:
<div class="links">
<h2>Links</h2>
<a href="http://jhclibrary.weebly.com/" alt="JHC Library Website">
<button class="button">
Library Website
</button>
</a>
<a href="http://jhclibrary.weebly.com/research.html" alt="Research">
<button class="button">
Research
</button>
</a>
<a href="http://jameshargestcollege.wheelers.co/" alt="eBooks">
<button class="button">
eBooks
</button>
</a>
<a href="10.0.0.7" alt="Library Catalogue">
<button class="button">
Library Catalogue
</button>
</a>
<br><br>
<a href="http://studentintranet/Documents/SubjectBooklets/ElLink.html" alt="Subject Booklets">
<button class="button">
Subject Booklets
</button>
</a>
<a href="http://studentintranet/Documents/Options/ElLink.html" alt="Option Books">
<button class="button">
Option Books
</button>
</a>
</div>
感谢您的帮助。谢谢!
答案 0 :(得分:0)
在<a>
标签内移动<button>
标签
<div class="links">
<h2>Links</h2>
<button class="button">
<a href="http://jhclibrary.weebly.com/" alt="JHC Library Website">
Library Website
</a>
</button>
<button class="button">
<a href="http://jhclibrary.weebly.com/research.html" alt="Research"> Research
</a>
</button>
<button class="button">
<a href="http://jameshargestcollege.wheelers.co/" alt="eBooks">
eBooks
</a>
</button>
<button class="button">
<a href="10.0.0.7" alt="Library Catalogue">
Library Catalogue
</a>
</button>
<br>
<br>
<button class="button"> <a href="http://studentintranet/Documents/SubjectBooklets/ElLink.html" alt="Subject Booklets">
Subject Booklets
</a>
</button>
<button class="button">
<a href="http://studentintranet/Documents/Options/ElLink.html" alt="Option Books">Option Books
</a>
</button>
</div>
答案 1 :(得分:0)
该行是按钮代码中<a>
标签的延续。将其display
属性从inline
(默认情况下)更改为inline-block
应该可以解决此问题。
.links a {
display: inline-block;
}