gpt4 book ai didi

html - href _self 不适用于修改后的

转载 作者:太空宇宙 更新时间:2023-11-04 06:37:12 24 4
gpt4 key购买 nike

围绕这个修改<button>有一个 href 应该在同一窗口中打开链接,但这不会发生。打开此链接的唯一方法是添加 target="_blank"反而。 如何解决?

.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%)
}

button.circle {
width: 65vh;
height: 65vh;
border: 0;
background-color: transparent;
}

button.circle::after {
z-index: -1;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
content: '';
display: block;
background: teal;
border-radius: 100%;
animation: breathe 4.5s ease infinite alternate running;
}

@keyframes breathe {
from { transform: scale(1); }
to { transform: scale(1.4); }
}
<a href="https://www.w3schools.com" target="_self"><button class="circle centered">Click me</button></a>

最佳答案

根据 HTML5 规范将按钮嵌套到 anchor 标记中是无效的 document .

不能将以下内容嵌套到 anchor 标记中:

<a>

<audio> (if the controls attribute is present)

<button>

<details>

<embed>

<iframe>

<img> (if the usemap attribute is present)

<input> (if the type attribute is not in the hidden state)

<keygen>

<label>

<menu> (if the type attribute is in the toolbar state)

<object> (if the usemap attribute is present)

<select>

<textarea>

<video> (if the controls attribute is present)

关于html - href _self 不适用于修改后的 <button>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54115733/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com