让我们在语义上使按钮成为按钮并使用 CSS 设置样式。这是 HTML 的症结所在,它非常简单:
<button class="button">
Read more
</button>
CSS 是完成繁重工作的地方。如果您运行代码片段,很难发现它与原始代码之间的区别。
a {
text-decoration: none;
}
button.button {
background: transparent;
border: 4px solid white;
color: white;
display: block;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 16px;
padding: 7px 46px 7px 10px;
position: relative;
}
button.button:after {
border-left: 4px solid white;
content: ">";
padding: 7px 10px;
position: absolute;
right: 0;
top: 0;
bottom: 0
}
a {
text-decoration: none;
}
div.info_box {
float: left;
width: 230px;
height: 230px;
padding: 40px;
background: #A95563;
color: white;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
div.box_title {
font-size: 22px;
padding: 0px 0px 20px 0px;
}
div.box_main {
font-size: 16px;
line-height: 120%;
height: 120px;
}
a {
text-decoration: none;
}
button.button {
background: transparent;
border: 4px solid white;
color: white;
display: block;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 16px;
padding: 7px 46px 7px 10px;
position: relative;
}
button.button:after {
border-left: 4px solid white;
content: ">";
padding: 7px 10px;
position: absolute;
right: 0;
top: 0;
bottom: 0
}
<div class="info_box">
<div class="box_title">My title</div>
<div class="box_main">The quick brown fox jumps over the lazy dog</div>
<a href="">
<button class="button">
Read more
</button>
</a>
</div>