bs4自定义选择无法正常工作

时间:2018-05-02 12:52:46

标签: css twitter-bootstrap bootstrap-4

这里的bs4示例:https://getbootstrap.com/docs/4.0/components/forms/#select-menu

我在我的网站上使用它:

// Import full bs4
@import "node_modules/bootstrap/scss/bootstrap";

结果看起来是这样的:

enter image description here

正如你所看到的,有双箭头,一个来自Chrome,另一个是背景,为什么会发生这种情况?此外,我无法在此选择列表上设置填充(不是选项,而是选择列表本身)

更新

我的BS4有什么东西,如果我从CDN使用它,那么它有效。我这样使用它:

{{1}}

结构是:

enter image description here

我使用不正确?

2 个答案:

答案 0 :(得分:1)

我希望你没有正确的尝试, 您可以尝试此代码

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<select class="custom-select custom-select-lg mb-3 mt-5">
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

答案 1 :(得分:0)

问题发生在autoprefixer,我没有使用它。在我的情况下,我使用了gulp,这里是gulpfile.js的内容:

gulp.task('sass', function(){
    return gulp.src([
        'scss/app.scss'
    ])
        .pipe(sass()) // Converts Sass to CSS with gulp-sass
        .pipe(CleanCSS())
        .pipe(autoprefixer())
        .pipe(gulp.dest('css'))
});
没有它,

无法工作。

相关问题