bootstrap4错误? reboot.css覆盖核心Bootstrap(按钮链接文本为黑色)

时间:2018-12-16 14:42:22

标签: bootstrap-4

请参阅下面的摘录,摘自Bootstrap Documentation(由于不需要,我仅删除了js)

我来自bootstrap3,我从未真正使用过4,但是按钮文本应该是白色,而不是黑色...这是一个错误吗?

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <title>Test</title>
</head>
<body>
<div class="container" style="margin-top: 20px">
    <h1>Hello word!</h1>
    <p><a class="btn btn-primary">Let's go ></a> </p>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

使用role="button"标记代替href时,您需要添加a和一些button

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <title>Test</title>
</head>
<body>
<div class="container" style="margin-top: 20px">
    <h1>Hello word!</h1>
    <p><a class="btn btn-primary" role="button" href="#">Let's go ></a> </p>
</div>
</body>
</html>

来自here

  

在用于触发的元素上使用按钮类时   页内功能(如折叠内容),而不是链接   到当前页面中的新页面或部分,这些链接应   被赋予角色=“按钮”以适当地传达其目的   辅助技术,例如屏幕阅读器。