html - 如何制作类似 Twitter-Bootstrap 的按钮

标签 html css twitter-bootstrap

我基本上想创建一个按钮,就像这一侧的大“下载 Bootstrap”按钮:http://getbootstrap.com/

注意:我想自己使用 css 和 html 创建按钮,而不是使用 twitter-bootstrap 框架

我能够做得很好,但后来我注意到有一个错误:http://jsfiddle.net/vk5DV/

如果将鼠标悬停在按钮上时放大,您会发现按钮的一 Angular 有问题。我认为链接本身的样式是白色背景的,但我不知道为什么。

#googlink a {
    color: white;
    transition: all 0.2s linear 0s;
}
#googlink :hover {
    background-color: white !important;
    color: #99CC00;
}

为什么链接也有白色背景(而不仅仅是按钮 div)?

最佳答案

如果添加边框半径似乎没问题

例如

#googlink :hover {
    background-color: white !important;
    border-radius: 6px;
    color: #99CC00;
}

http://jsfiddle.net/f3kzb/show/

虽然如果你稍微简化一下,我认为它可以很好地与你已有的代码配合使用。还指定为与任何链接一起使用的类。

http://jsfiddle.net/fe25t/

html

<div id="green">

<a href="http://google.com/" class="special-link">Google</a>

</div>

CSS

body {
    margin: 0;
    padding: 0;
}
#green {
    background-color: #99CC00;
}
a {
    text-decoration: none;
    color: black;
}
.special-link {

    border-radius: 10px;
    margin: 40px;
    display: inline-flex;
    height: auto;
    width: auto;
    font-size: 65px;
    background-color: #99CC00;
    border: 2px solid white;
    color: white;
    transition: all 0.2s linear 0s;
}

.special-link:hover {
    background-color: white !important;
    color: #99CC00;
}

关于html - 如何制作类似 Twitter-Bootstrap 的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24468633/

相关文章:

html - 如何使用 bootstrap 3 将一组按钮居中放置到 div 中

twitter-bootstrap - 少混合 col bootstrap 类?

html - 如何使用图标创建左侧导航栏

javascript - 为一组中的 div 设置动画

html - 添加边距使最后一列成为新行

html - 创建用户可以订阅的动态 ICS 文件

css - "flex: ..."是否意味着 "display: flex"?

javascript - 检查 DOM 元素是否存在于 DIV 中,然后按顺序运行分配给这些元素的函数

html - 将包含另一个带有内联 block 的 div 的 div 居中

javascript - 有没有一种简单的方法来设置滚动条的样式