<div class='row'>
  <div class='column-left'>
    <p class='category-name'>栏目名</p>
  </div>
  <div class='column-right'>
    <a class='more-link' href='#'>更多</a>
  </div>
</div>
<style>
  .row {
    background-color: #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
  }
  .column-left {
    color: #fff;
  }
  .category-name {
    font-size: 20px;
    font-weight: bold;
    margin: 0;
  }
  .column-right {
    text-align: right;
  }
  .more-link {
    color: #fff;
    text-decoration: none;
    border: 1px solid #fff;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
  }
  .more-link:hover {
    background-color: #fff;
    color: #ccc;
  }
</style>
CSS 实现一行带背景的栏目标题和更多链接

原文地址: https://www.cveoy.top/t/topic/neKd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录