【问题标题】:Bootstrap React Jumbotron Background ImageBootstrap React Jumbotron 背景图像
【发布时间】:2021-06-18 21:34:52
【问题描述】:

有谁知道如何在 Bootstrap React 中将背景图片放到 jumbotron 上?我尝试过使用样式表和内联样式(camelCase),但都没有奏效。到目前为止,我的 css 样式表中有这个。我可以让图像出现在 chrome 开发工具中,但 Bootstrap React 必须以某种方式覆盖背景颜色,但我不确定如何。这是我在样式表上的代码:

.jumbotron {
    background-image: url("https://freebigpictures.com/wp-content/uploads/shady-forest.jpg")!important;
 }

这是我的组件代码:

<>
<Jumbotron fluid>
<Container>
<h1>Fluid jumbotron</h1>
<p>
  This is a modified jumbotron that occupies the entire horizontal space of
  its parent.
</p>
</Container>
</Jumbotron>
</>

任何帮助将不胜感激!

【问题讨论】:

    标签: reactjs twitter-bootstrap


    【解决方案1】:

    很晚了,但是style属性是“backgroundImage”,你可以这样称呼它:

    <Jumbotron fluid style={{backgroundImage: `url(...)`}}>
    

    【讨论】:

      猜你喜欢
      • 2014-03-26
      • 2016-12-13
      • 2015-02-15
      • 1970-01-01
      • 2014-09-13
      • 2017-07-20
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多