3

I have already included this:

<style>
html, body {
    padding: 0;
    margin: 0;
    font-family: Segoe UI;
}
</style>

And below is my code for the div I am referring to including its content:

<div class="learn-more">
  <div class="container">
  <div class="row">
    <h1 style="color: #292f33;">SERVICES</h1>
    <div class="col-md-4">
      <h4>Delivery</h4><hr style="max-width: 70px;">
      <p style="text-align: center; font-size: 19px; font-family: Segoe UI;">At Gadget Market we offer free delivery for purchases prized over $300. Our delivery service is up to your doorstep or wherever you would like within the country.</p>
    </div>

    <div class="col-md-4">
      <h4>Warranty</h4><hr style="max-width: 70px;">
      <p style="text-align: center; font-size: 19px; font-family: Segoe UI;">Devices from Gadget Market come with not less than a 12-month warranty. Gadget issues within this period will be catered for and a replacement provided if need be.</p>
    </div>

    <div class="col-md-4">
      <h4>Money back Guarantee</h4><hr style="max-width: 70px;">
      <p style="text-align: center; font-size: 19px; font-family: Segoe UI;">If you are not satisfied with the product you bought from Gadget market, then you can return the gadget to us within 30 days for a 90% money back guarantee.</p>
    </div>

    </div>
</div>
</div>

And here is the CSS:

.learn-more {
  background-size: cover;
  width: inherit; 
  margin: 0;
  padding: 0; 
  background-color: rgba(85,172,238,0.8); 
}

.learn-more .col-md-4 h4 {
    font-family: Cambria;
    font-size: 26px;
    text-align: center;
    color: #292f33;
}

.learn-more .col-md-4 p {
    font-family: Segoe UI;
    font-size: 19px;
    text-align: center;
    color: #292f33;
}

However the div .learn-more still doesn't span the entire width. And I find this to be weird because I used the exact same code on another project and it worked!

And the link below is the image:

The result

Johannes
  • 64,305
  • 18
  • 73
  • 130
Andrea Tand
  • 91
  • 1
  • 2
  • 14

5 Answers5

2

This is a Bootstrap matter. Change this

<div class="container">

to this

<div class="container-fluid">

And (to prevent a horizontal scrollbar) change the <div class="learn-more"> into a <section class="learn-more">, as per this post:

https://stackoverflow.com/a/35236594/1447509


Note that typical Bootstrap scaffolding looks like this:

<body>
    <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-xs-12 col-md-4">
                    //content
                </div>
                <div class="col-xs-12 col-md-4">
                    //content col 2
                </div>
            </div><!-- .row -->
            <div class="row">
                <div class="col-xs-12 col-md-4">
                    //content
                </div>
                <div class="col-xs-12 col-md-4">
                    //content col 2
                </div>
            </div><!-- .row -->
        </div><!-- .container -->
    </section>
</body>
Community
  • 1
  • 1
cssyphus
  • 37,875
  • 18
  • 96
  • 111
1

Make a style code for the div that sets the width at 100%

.learn-more {
  width:100%;
}
Sub 6 Resources
  • 1,674
  • 15
  • 31
  • It appears like your div is inheriting its width from the parent element. What element is the parent of the div, and what styles does it have? – Sub 6 Resources May 16 '16 at 23:14
  • Oh sorry, no it isn't. That was supposed to be 'width: 100%;' and I have changed it but it still doesn't work. – Andrea Tand May 16 '16 at 23:26
1

Please try

.learn-more,.learn-more .container{
  width : 100%;
  display: block;
}
Dezefy
  • 2,048
  • 1
  • 14
  • 23
0

You need to remove the inherit characteristic. width: inherit gives 100% of the parent. Not the whole document. To ignore the typical restrictions on width being more than the parent, do the below.

.learn-more{
  position: absolute;
  width: 100%;
}
David Archibald
  • 1,431
  • 14
  • 27
  • I'm not going to put this as an answer, unless if works, but remove the h1, and if that doesn't work remove all the children of learn-more, at least this way we know where the problem is. If one works, tell me and I'll edit the answer. – David Archibald May 16 '16 at 23:43
0

I suggest adding !important for padding and margin to the selector html, body like this:

html, body {
  padding: 0 !important;
  margin: 0 !important;
  font-family: Segoe UI;
}

As in your screenshot, I can see scrollbar is at the bottom so you are having more divs on top and probably more CSS, so if something is changing padding and margin value then it gets corrected now. You should also check if your divs are closing properly and don't have any unclosed div prior to your code, then try adding overflow:hidden to .learn-more.

David Archibald
  • 1,431
  • 14
  • 27
Rakesh
  • 66
  • 3