Bootstrap is fixing height in header - html

I´m a designer with some coding skills, but far from being a programmer. Currently I´m working in a website based on a Bootstrap template, doing good enough except an issue that is driving me nuts: apparently Bootstrap´s CSS is overriding the site CSS, adding a fixed head in the index.html header, which contains a div that contains an image carousel.
Displaying the site in small devices (tablets and cell phones), the carousel hides properly using "hidden-xs" and "hidden-xm" classes, but the header remains with a fixed height of 929px as Element Inspector shows, generating a very tall empty space before the next section.
Below you´ll find the header code, including carousel:
<header id="intro">
<!-- CAROUSEL STARTS -->
<div id="myCarousel" class="carousel slide hidden-xs hidden-xm" data-ride="carousel" data-interval="2000" style="border:1px solid red;">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="d-block img-fluid" src="img/header-01.jpg" align="left" alt="Slide 01">
<!-- <div class="carousel-caption">
<p>El conocimiento es libertad</p>
</div> -->
</div>
<div class="item">
<img class="d-block img-fluid" src="img/header-02.jpg" alt="Slide 02">
<!-- <div class="carousel-caption">
<p>El respeto a sí mismo</p>
</div> -->
</div>
<div class="item">
<img class="d-block img-fluid" src="img/header-03.jpg" alt="Slide 03">
<!-- <div class="carousel-caption">
<p>El respeto a los demás</p>
</div> -->
</div>
<div class="item">
<img class="d-block img-fluid" src="img/header-04.jpg" alt="Slide 04">
<!-- <div class="carousel-caption">
<p>Jardín - Primaria - Secundaria</p>
</div> -->
</div>
<div class="item">
<img class="d-block img-fluid" src="img/header-05.jpg" alt="Slide 05">
<!-- <div class="carousel-caption">
<p>El conocimiento es libertad</p>
</div> -->
</div>
<div class="item">
<img class="d-block img-fluid" src="img/header-06.jpg" alt="Slide 06">
<!-- <div class="carousel-caption">
<p>El respeto a sí mismo</p>
</div> -->
</div>
<!-- Wrapper for slides ENDS -->
</div>
<!-- CAROUSEL ENDS -->
</div>
</header>
And a couple of screenshots:
Home page full size (index.html)
Home page small devices width

Try putting this in your CSS file
#intro {
height: auto !important;
}
This should override the default height pixel.
If you want to have the fullscreen image, then write like this
#intro {
height: 100vh !important;
}
Hope this fixes your problem.

Related

BootStrap 5.0 beta 1 Carousel Slide not working

I'm having trouble making the carousel actually slide. It would just swap to next item without any "slide" transition. I've even went through the BS 5 doc and it doesn't do the slide transition either. Has it been removed?
HTML:
<div id="carouselExampleSlidesOnly" class="carousel slide" data-bs-slide ="true" data-bs-ride="carousel" data-bs-interval="1000" data-bs-pause="hover">
<div class="carousel-inner">
<div class="carousel-item active " style = "background-color:red">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item" style = "background-color:blue">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item" style = "background-color:yellow">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
</div>
CSS:
.carousel-item {
height: 500px;
}
Windows 10 > Display > Tick show animations in windows

Gallery grid overflowing in live server

I have an HTML document. When I run it in localhost it runs well. But the problem occurs when I run it in live server. the gallery item is overflowing. But the interesting things is when I resize the windows it automatically fixes itself. I have used Magnific popup and Isotope.
Images that shows in live server
here is my html code:
<div class="gallery">
<div class="row">
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item department doctor patient" href="assets/images/gallery/gallery-3.jpeg">
<img src="assets/images/gallery/gallery-3.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item doctor department" href="assets/images/gallery/gallery-4.jpeg">
<img src="assets/images/gallery/gallery-4.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item department" href="assets/images/gallery/gallery-5.jpeg">
<img src="assets/images/gallery/gallery-5.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item doctor department" href="assets/images/gallery/gallery-6.jpeg">
<img src="assets/images/gallery/gallery-6.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item surgery department" href="assets/images/gallery/gallery-7.jpeg">
<img src="assets/images/gallery/gallery-7.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
<div class="col-sm-6 col-md-4 gallery-item patient" href="assets/images/gallery/gallery-8.jpeg">
<img src="assets/images/gallery/gallery-8.jpeg" alt="" class="gallery-img" />
</div>
<div class="col-sm-6 col-md-4 gallery-item doctor" href="assets/images/gallery/gallery-9.jpeg">
<img src="assets/images/gallery/gallery-9.jpeg" alt="" class="gallery-img" />
</div>
<!-- gallery Image -->
</div> <!-- end .row -->
</div> <!-- end .gallery -->
This has to do with how your images are loading. I'm guessing on the live server they are making a call to the server and then being injected into the DOM using JavaScript. There are a variety of ways to fix this but the simplest is to add the width and height attributes on your image tags.

Bootstrap carousel out of document flow?

i'm currently developing a landing page for a startup, while i was making the "hero section" i wanted to use a carousel, everything worked fine until i tried adding the next section, to my surprise the next section was BEHIND the hero section, i tried reading through my code and tweaking a bit on chrome dev tools but i can't seem to find the problem, could you help me?
I've tried changing the position for all of the items in the carousel to static and their display to block to see if it went back to normal without success.
CODE:
HTML
<section id='hero-section'>
<div class="hero-carousel carousel slide" data-ride="carousel">
<div class="carousel-item active" data-interval="8000">
<img class="d-block w-100" src="includes/media/images/slide1.png" alt="">
<div class="carousel-caption d-none d-md-block">
<h2>Alcanza tus sueños</h2>
<p>Los créditos de nómina Axelera son fáciles de obtener y de pagar</p>
<button class='cta-button btn btn-md' type="button" name="button">Solicita tu crédito</button>
</div>
</div>
<div class="carousel-item" data-interval="8000">
<img class="d-block w-100" src="includes/media/images/slide2.png" alt="">
</div>
<div class="carousel-item" data-interval="8000">
<img class="d-block w-100" src="includes/media/images/slide3.png" alt="">
</div>
</div>
</section>
<section>
<h2>Test</h2>
</section>
CSS
.carousel-item img{
height: 500px;
object-fit: cover;
}
The next section (the one with the h2 "test" tag) should be below not behind the other section.
Just add the Bootstrap class clearfix and you are good to go!
.carousel-item img{
height: 500px;
object-fit: cover;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<section class="clearfix" id='hero-section'>
<div class="hero-carousel carousel slide" data-ride="carousel">
<div class="carousel-item active" data-interval="8000">
<img class="d-block w-100" src="https://via.placeholder.com/960x500" alt="">
<div class="carousel-caption d-none d-md-block">
<h2>Alcanza tus sueños</h2>
<p>Los créditos de nómina Axelera son fáciles de obtener y de pagar</p>
<button class='cta-button btn btn-md' type="button" name="button">Solicita tu crédito</button>
</div>
</div>
<div class="carousel-item" data-interval="8000">
<img class="d-block w-100" src="https://via.placeholder.com/960x500" alt="">
</div>
<div class="carousel-item" data-interval="8000">
<img class="d-block w-100" src="https://via.placeholder.com/960x500" alt="">
</div>
</div>
</section>
<section class="clearfix">
<h2>Test</h2>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/js/bootstrap.bundle.min.js"></script>

Carousel ruins navbar if I remove padding from it (Bootstrap framework)

I want my carousel to appear immediately after my navbar but if I remove padding from carousel it appears after my navbar but the navbar stretches far from view in mobile view
<div class="container-fluid m-t-3 p-x-0 "> //Code with padding so it appears under navbar
<div class="container-fluid "> //When I remove margin and padding the navbar stretches too far in mobile view
Navbar on mobile view when I remove padding from carousel
CodePen link
Commented the parts that I'm trying to fix and the problem.
Add the class img-responsive to the parent element of the images in the carousel or to each image in the carousel, this will allow them shrink along with the window size. I added this to your code in code pen at line 63:
<div class="carousel-item active randomize img-responsive">
<img src="http://placekitten.com/700/500" alt="First slide ">
<div class="carousel-caption hidden-md-down">
<h3>Sedefi</h3>
<p>webpage 1</p>
</div>
</div>
<div class="carousel-item img-rounded">
<img src="http://placecorgi.com/700/500?index=random" alt="Second slide">
<div class="carousel-caption hidden-md-down">
<h3>Sedefi</h3>
<p>webpage 2</p>
</div>
</div>
<div class="carousel-item">
<img src="http://placecorgi.com/700/500?index=random" alt="Third slide">
<div class="carousel-caption hidden-md-down">
<h3>Sedefi</h3>
<p>webpage 3</p>
</div>
</div>
</div>
You can read more about styling images with bootsrap here
And here is what it looks like when you use a smaller dislpay:

Giving camuflage to home page image that isn't wide enough

I am trying to make one of these modern designs where there's a carousel of images in the top of the home page of the webpage.
I am using Bootstrap 3 and so far I have managed to make it behave the way it should, but I feel like that's only going to happen in my screen, because I worked partially with fixed proportions so the images would look perfect in my screen, so they all have the same width and height. Here's how it looks:
If these images are displayed in a thinner screen I guess there would be no problem, or would there? I still have to test this, but I am pretty sure that there would not be any problem; anyway this is not that much of a concern for me right now, I am focused in the other issue. But if they're displayed in a wider screen an ugly border will appear, just like this:
That looks really bad, I think that I should center the image and treat those borders in a way that goes well along with the image, like if both image and borders were one whole. Any ideas?
Also I would need to reposition the carousel slide buttons to be fitted in the image instead outside. I am not that sure about how to do that either.
Here the code in case you need it:
<!-- Carousel -->
<div class="this-centrar-contenido this-margen-vertical">
<div id="carousel-inicio" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-inicio" data-slide-to="0" class="active"></li>
<li data-target="#carousel-inicio" data-slide-to="1"></li>
<li data-target="#carousel-inicio" data-slide-to="2"></li>
<li data-target="#carousel-inicio" data-slide-to="3"></li>
<li data-target="#carousel-inicio" data-slide-to="4"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="img/img1.jpg">
<div class="carousel-caption">
text
</div>
</div>
<div class="item">
<img src="img/img2.jpg">
<div class="carousel-caption">
text
</div>
</div>
<div class="item">
<img src="img/img3.png">
<div class="carousel-caption">
text
</div>
</div>
<div class="item">
<img src="img/img4.png">
<div class="carousel-caption">
text
</div>
</div>
<div class="item">
<img src="img/img5.png">
<div class="carousel-caption">
text
</div>
</div>
</div> <!-- /.carousel-inner -->
</div> <!-- /#carousel-inicio -->
<!-- Controls -->
<a class="left carousel-control" href="#carousel-inicio" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left this-icono-grande"></span>
</a>
<a class="right carousel-control" href="#carousel-inicio" data-slide="next">
<span class="glyphicon glyphicon-chevron-right this-icono-grande"></span>
</a>
</div> <!-- /.col-md-12 -->
<!-- /Carousel -->
And custom css (the rest is Bootstrap 3 default for carousels)
.carousel-control
{
height: 600px;
}
For fitting the images I would use the images as background-images for each div.item, and set background-size: cover; in the css. For that each div.item needs an id or a specific class:
HTML:
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div id="img_1" class="item active">
<div class="carousel-caption">
text
</div>
</div>
<div id="img_2" class="item">
<div class="carousel-caption">
text
</div>
</div>
...
<div id="img_5" class="item">
<div class="carousel-caption">
text
</div>
</div>
</div> <!-- /.carousel-inner -->
CSS:
#img_1 {
background: url('img/img1.png') no-repeat center center;
background-size: cover;
}
#img_2 {
background: url('img/img2.png') no-repeat center center;
background-size: cover;
}
...
#img_5 {
background: url('img/img2.png') no-repeat center center;
background-size: cover;
}
Now, you won't have any problem with the different viewports. Change the size of your browser's window to test it.