首頁  >  問答  >  主體

如何使用 html 和 css 新增超連結功能

我有一些包含一些css 的HTML 程式碼,我希望該按鈕實際上具有像超連結一樣的用途,我按下它,它會將我帶到某個文件或網址,我嘗試過在字段內使用實際的超鏈接,但它看起來很難看,只能按超鏈接,我嘗試添加一個HTML 預設超鏈接按鈕,但它無法著色。

程式碼如下:

<html>
<body style="background-color:rgb(48, 45, 45)">
<font color="white">
<font color="#4CAF50">
<head>
<style>
.button {
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {background-color: #4CAF50;}
.button2 {background-color: #008CBA;}
</style>
</head>
<body>
<button class="button button1">Green</button>
<button class="button button2">Blue</button>
</body>

P粉596191963P粉596191963182 天前358

全部回覆(2)我來回復

  • P粉949267121
  • P粉035600555

    P粉0356005552024-04-02 17:54:27

    使用 onclick 元素:

         
        sssccc

    回覆
    0
  • 取消回覆