【问题标题】:Add URL link in CSS & Html to button [duplicate]将 CSS 和 Html 中的 URL 链接添加到按钮 [重复]
【发布时间】:2013-05-24 15:14:19
【问题描述】:

如何将 CSS 按钮更改为带有 URL 链接的按钮? 我读过我还需要添加 HTML 代码?

我能找到的按钮的唯一代码是这个:

 .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {
position: relative;
margin-bottom: 1px;
color: #FFF;
background-color: #2265B9;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#FCEEC1), to(#EEDC94));
background-image: -moz-linear-gradient(top, #FCEEC1, #EEDC94);
background-image: -ms-linear-gradient(top, #FCEEC1, #EEDC94);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FCEEC1), color-stop(100%, #EEDC94));
background-image: -webkit-linear-gradient(top, #069CFF, #0A6AB6);
background-image: -o-linear-gradient(top, #FCEEC1, #EEDC94);
background-image: linear-gradient(top, #FCEEC1, #EEDC94);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);
border-color: #EEDC94 #EEDC94 #E4C652;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-width: 1px;
border-style: solid;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

我不确定这是一个正确的问题还是正确的代码。

【问题讨论】:

    标签: html css url


    【解决方案1】:

    链接不是通过 CSS 添加的,而是通过 HTML 添加的:

    <a href="http://example.com">My Link</a>
    

    如果您希望它以您给定的样式显示,只需给它一个 .ui-state-highlight 类:

    <a href="http://example.com" class="ui-state-highlight">My Styled Link</a>
    

    【讨论】:

    • 嗨谢谢詹姆斯,但我很困惑我不知道在哪里添加这个html代码,CSS按钮文件夹上只有一个html文件,
    • 如何将此按钮添加到您的页面?
    • 这个按钮是jomres软件自带的,我只能从中看到一个CSS jquery文件/代码,虽然不完全明白你的意思。
    • 通常情况下,使用 HTML 和 CSS,您将拥有一个 HTML 页面,该页面链接到您的 CSS 页面以进行样式设置。 HTML 是您添加元素(如链接)的地方,而 CSS 是您为其设置样式的地方。
    • 哦,我明白了,在 css/ui_template/mybutton.css 文件夹中只有一个 index.html 文件,其中只有正文和颜色代码,但我猜官方的 html 文件不在 CSS 文件夹中,它必须在另一个地方,好吧我会问软件开发这个文件位置在哪里..谢谢詹姆斯
    【解决方案2】:

    如果你只是想给一个按钮添加一个链接,那么你可以使用

    <button onlick="#"><a href="http://google.com/"> Open this website</a></button>
    

    或者你想把网址打开到新页面??

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-11
      • 2023-01-15
      • 2016-10-01
      • 2021-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多