【问题标题】:I made the Anchor tag as button and it is not working我将 Anchor 标签设为按钮,但它不起作用
【发布时间】:2021-03-19 12:59:20
【问题描述】:

我试图将锚标记作为按钮并尝试在其上添加一些 css 但它不可点击 这是我的html代码。 我正在关注一个 youtube 教程,我 100% 关注了该视频,但我的视频无法正常工作,对不起,我是网络开发的新手,谢谢您的帮助。

    <body>
      <!-- Welcome Page -->
      <section id="ulambg"> 
        <div class="ulambg container">
          <div>
            <h1>Eatwell</h1>
            <a href="#" type="button" class="btnulam">Ready to Eat</a>
            <a href="#" type="button" class="btn btn-primary">Ready to Cook</a>
          </div>
        </div>
      </section>
    
      <!-- End Welcom Page -->

这是我在程序中使用的css,是因为Java吗?我读过一些论坛说如果你在你的机器上禁用了你的java,一些java函数将无法工作。

    @import url('https://fonts.googleapis.com/css2?family=Raleway:wght@600&display=swap');
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    html {
        font-size: 15px;
        font-family: 'Raleway', sans-serif ;
    }
    
    a {
        text-decoration: none;
    }
    
    .container { 
        min-height: 100vh;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
     }
     
    
    /*Welcome Page Section Ulambg*/
    #ulambg { 
        background-image: url(./img/bg.jpg);
        background-size: cover;
        background-position: top center;
        position: relative;
     }
     #ulambg::after {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 100%;
        background-color: black;
        opacity: .5;
     }
    
     #ulambg h1 {
        color: white;
        width: fit-content;
        font-size: 4rem;
        position: relative;
    
     }
    
     #ulambg .btnulam {
        display: inline-block;
        padding: 10px 30px;
        color: blue;
        background-color: transparent;
        border: 2px solid blue;
        font-size: 2rem;
        text-transform: uppercase;
        letter-spacing: .1rem;
        margin-top: 30px;
        transition: .3s ease;
        transition-property: background-color;
     }
    
     #ulambg .btnulam:hover {
        color: white;
        background-color: blue;
     }
    
    
    /*Welcome Page Sectio Ulambg*/

【问题讨论】:

  • 你还没有给你的锚标签提供任何href链接,那么它将如何工作。

标签: php css frontend


【解决方案1】:

在#ulambg::after中添加z-index: -1,它是背景,不应该覆盖页面。

Demo

【讨论】:

    【解决方案2】:

    如果我理解你是正确的,你的意思是 我自己是新手,但希望我能以任何方式提供帮助:)

    【讨论】:

      猜你喜欢
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 2021-09-17
      • 2018-11-09
      • 2021-09-29
      • 2017-07-01
      • 2017-08-09
      • 2021-10-11
      相关资源
      最近更新 更多