如何修复部分背景色

时间:2019-04-23 16:32:27

标签: html css bootstrap-4

对于先前的错误,我深表歉意。我无法理解为什么我的“小生物”部分的背景颜色没有变化。我觉得这与引导轮播有关,但与idk有关。我希望能够了解自己在做什么以及如何避免再次发生这种情况。任何帮助将不胜感激。

谢谢

我尝试更改其他部分的颜色并更改高度,并移动了样式表。

    <!DOCTYPE html>
    <html lang="en" dir="ltr">

    <head>
      <meta charset="utf-8">
      <title>Bagwell Productions</title>

      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="viewport" content="height=device-height, initial-scale=1.0">
      <!-- Google Font -->
      <link href="https://fonts.googleapis.com/css?family=Montserrat|Ubuntu" rel="stylesheet">

      <!-- CSS & bootstrap stylesheet -->
      <link rel="stylesheet" href="Bagwell\style.css">
      <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


      <!-- JS -->
      <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>





    </head>

    <body>


      <section id="navbar">
        <!-- Nav Bar -->

        <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
          <a class="navbar-brand" href="#">Bagwell Productions</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
            <div class="navbar-nav ml-auto">
              <a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
              <a class="nav-item nav-link" href="#">Gallery</a>
              <a class="nav-item nav-link" href="#">About Me</a>
              <a class="nav-item nav-link" href="#">Contact Me</a>
            </div>
          </div>
        </nav>
      </section>



      <section id="slideshow">


        <!-- slideshow -->
        <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
          <div class="carousel-inner">
            <div class="carousel-item active">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-876787\126A0171.JPG" alt="league of extraordinary women" style="width:100%" style="height:auto" ; class="d-block w-100">
            </div>
            <div class="carousel-item">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-876787\IMG_3732.JPG" alt="Grad Pics" style="width:100%" ; style="height:auto" class="d-block w-100">
            </div>
            <div class="carousel-item">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-95bb54\IMG_9997.JPG" alt="pit bull" style="width:100%;" style="height:auto" "class=" d-block w-100"">
            </div>
            <div class="carousel-item">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-95bb54\IMG_7098.JPG" style="width:100%;" style="height:auto" class="d-block w-100">
            </div>
            <div class="carousel-item">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-876787\IMG_1938.JPG" alt="walking" style="width:100%;" style="height:auto" class="d-block w-100">
            </div>
            <div class="carousel-item">
              <img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-876787\IMG_1749.JPG" alt="nasa grad" style="width:100%;" style="height:auto" class="d-block w-100">
            </div>
          </div>
          <!-- controls for slideshow -->
          <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
          <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
        </div>
      </section>

        <!-- Small intro -->
      <section id="small-bio">

        <div class="Bottom-intro">
          <h3>Welcome to the photography portfolio of William Bagwell. the Gallery's in this website showcase professional work in different settings.</h3>



        </div>

      </section>
    </body>

    </html>

    #small-bio{
      background-color: blue  !important;
    }
    #slideshow{
      overflow: hidden;
    }

    #slideshow{
      overflow: auto;

    }

    }
    h3{
    background-color: blue;
    }

    .carousel-inner{
      overflow: ;
      padding-bottom: 7%;
      background-color: red;
      overflow: hidden;
    }
    .Bottom-intro{
      position: relative;
      overflow: hidden;
      height: 300px;
      width: 100%;
      color:#fff;
      background-color: #ef8172;
      text-align: center;
    }

```





2 个答案:

答案 0 :(得分:0)

查看您的style.css链接

<link rel="stylesheet" href="Bagwell\style.css">

将其更正为

  <link rel="stylesheet" href="Bagwell/style.css">

可以帮助

答案 1 :(得分:0)

好吧,您正在尝试将背景色设置为轮播,其中图像占据了您容器空间的100%(即轮播内部)。

如果您希望容器使用背景色,则可以将图像尺寸减小到80%,并留出裕量:将图像自动设置为0,以便它们可以居中对齐。

您还提到了图像的冗余宽度,1)通过添加w-100,2)使用内联宽度。使用任何一个。并且您在元素中使用了2个样式标签,这是不正确的。

例如使用内联样式

<img src="C:\Users\ghost\Desktop\Projects\Bagwell\wetransfer-95bb54\IMG_7098.JPG" style="height:auto" class="d-block w-75 mx-auto">

例如使用引导程序类

try { startActivityForResult(intent, REQUEST_IMAGE); return true; } catch (ActivityNotFoundException e) { return false; }

对每个图像标签都执行此操作,并且您的图像后面应该有背景色。