如何让我的页脚像大多数常见的页脚一样水平显示?

问题描述 投票:0回答:1

我希望页脚看起来像大多数常见的页脚。

css 脚本的页脚部分。我想让它水平,但列应该垂直对齐或垂直列出。

 footer {
      background-color: #f5f5f5;
      padding: 30px 0;
      font-size: 14px;
    }

    footer h5 {
      font-size: 1.5rem;
      font-weight: bold;
      margin-bottom: 20px;
    }
    
    footer ul {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    
    footer ul li {
      margin-bottom: 10px;
    }
    
    footer ul li a {
      text-decoration: none;
      color: #333;
      font-size: 1.2rem;
    }
    
  footer ul li a:hover {
      color: #007bff;
    }
    
    footer p {
      font-size: 1.2rem;
      margin-top: 30px;
      color: #333;
    }


html footer styling cascade
1个回答
0
投票

您的代码完全正确,但是您需要将代码中的

footer
更新为
.footer
,因为我们需要选择footer内的所有元素。如果你想插入一些元素,那么你可以使用 html

添加它

所以正确的代码是

 .footer {
      background-color: #f5f5f5;
      padding: 30px 0;
      font-size: 14px;
    }

    footer h5 {
      font-size: 1.5rem;
      font-weight: bold;
      margin-bottom: 20px;
    }
    
    footer ul {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    
    footer ul li {
      margin-bottom: 10px;
    }
    
    footer ul li a {
      text-decoration: none;
      color: #333;
      font-size: 1.2rem;
    }
    
  footer ul li a:hover {
      color: #007bff;
    }
    
    footer p {
      font-size: 1.2rem;
      margin-top: 30px;
      color: #333;
    }
© www.soinside.com 2019 - 2024. All rights reserved.