Tips on reducing the height and improving responsiveness in Bootstrap 4

I've been struggling to adjust the image height to take up 75% of the screen. I attempted using height: 75%; and class="h-75", but it doesn't seem to be effective. Currently, I have class="h-800" with h-800 { height: 800px; }, but this approach isn't producing a responsive design.

A good example of what I'm aiming for can be seen at

Below is my HTML code:

  
<div id="" class="carousel slide" data-ride="carousel" data-interval="3000" data-pause="false">
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img src="https://images.pexels.com/photos/1779487/pexels-photo-1779487.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="h-800" alt="...">
        </div>
        <div class="carousel-item">
            <img src="https://images.pexels.com/photos/1999463/pexels-photo-1999463.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" class="h-800" alt="...">
        </div>
    </div>
</div>

And here's my CSS styling:

  
img {
    height: 75%;
    object-fit: cover;
    width: 100%;
}

.h-800 {
    height: 800px;
}

Answer №1

Utilize the viewport height for responsive design.

For instance, I've defined a CSS class called .h75

.h75{
     height: 75vh;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the potential ways in which an html IMG tag can disrupt the functionality of this

For years, I have been using this form code without any issues. The code functions perfectly and all the tags are correct. However, whenever I include an image tag, it displays a failure message and prevents the mail function in PHP from working. The hea ...

Is it possible to save any additions made to the DOM using JavaScript into local storage, so that it can be retrieved even after the page is reloaded?

Let's consider a scenario for testing purposes: you have a function that appends <li> elements inside an <ol> container, and you want to retain all the list items added. Is there a way to store them in Local Storage (or any other local sto ...

Can someone help me uncover the previous URL for login using just JavaScript? I've tried using document.referrer but it's not giving me the

Currently, I am utilizing express with pug templates and pure JavaScript. In order to enhance the user experience of my log in system, I would like to save the URL that someone came to the login page with, so that I can redirect them back to it once they h ...

The issue persists with Angular's overflow hidden not functioning properly, and similarly, the show password button is

I created a login page using Angular Material, but I'm facing some issues. The problem is that when I set the style overflow: hidden, the show password button stops working. Additionally, if I click the button twice, the webpage refreshes, which shoul ...

Spinning a CSS object around an axis

Trying to add a unique touch to my image rotation with CSS. While familiar with rotating around x, y, and z axis, I want to achieve a diagonal rotation this time. Wondering if there's a way to tweak the y axis for a more slanted effect on my image? ...

Unexpected outcomes occur from CSS nesting

Today I realized there is still so much to learn about CSS. How is it possible that the CSS style below produces that outcome? Stylesheet: li.item a:first-child {color: red} HTML List: <ul class="mylist"> <li class="item"><a ...

Creating unique navigation bar elements

I'm currently working on an application and facing an issue with the navigation from the Component to NavbarComponent. If you'd like to check out the application, you can visit: https://stackblitz.com/github/tsingh38/lastrada The goal is to hav ...

Convert HTML content to a PDF file with Java

Welcome to the community! My project involves extracting data from a website containing information on various chemical substances and converting it into a PDF while preserving the original HTML formatting, including CSS styles. For example, here is a li ...

Generate several invoices with just a single click using TypeScript

I'm interested in efficiently printing multiple custom HTML invoices with just one click, similar to this example: https://i.sstatic.net/hAQgv.png Although I attempted to achieve this functionality using the following method, it appears to be incorr ...

Items in a pair of distinct columns

I want to enhance a picture by adding three paragraphs on the left-hand side. Below is my HTML code: <md-toolbar layout-align="center center"> <h3>Traffic Light Component</h3> </md-toolbar> <md-grid-list md-cols ...

Unable to update Favicon in XAMPP

I've tried using XAMPP and even included the code for index.html, but the favicon won't budge. <!DOCTYPE html> <html> <head> <link rel="icon" href="favicon.ico" type="image/x-icon"> </head> <body> </body> ...

How to resolve the unusual spacing issue caused by Bootstrap?

I am encountering an issue with positioning two images on my website. I want one image to float all the way to the left of the viewport and the other to the right. However, there seems to be a strange space created on the right side of the right image. I a ...

Trouble aligning content in CSS? Try using justify-content center for perfect centering!

I am facing an issue with centralizing the content properly. Despite using justify-content:center, the layout breaks. https://i.sstatic.net/EMiw1.png When I apply justify-content:center, the layout appears like this: https://i.sstatic.net/lTJRi.png Her ...

Ways to assign dynamic widths to inner divs within a parent div automatically

I am working with divs <div id='top' > <div id='top-border' > </div> <div id='top-menu' > <jdoc:include type="modules" name="top-menu" style="well" /></div> </div> and adjust ...

Steps for showing retrieved data individually:

Currently, I am utilizing angular-js, JavaScript, and HTML in my project. I have successfully retrieved a list of customer names and their corresponding details from the database. However, I am looking to implement a feature where each record is displayed ...

Notes should be added to the Flutter page when it is executed on the emulator

I am working with 2 widgets in my project: ProjectPage and ProjectPageWeb, both of which have similar functionalities in displaying an iframe. The difference lies in the fact that they use different components to achieve this. ProjectPage utilizes the Web ...

Using Bootstrap for custom email design with Rails 5 in API mode

In my Rails 5 API application, I am looking to send visually appealing emails with Bootstrap. However, I encountered an error after including gem bootstrap in my Gemfile and running bundle install. The error message is: 7:in `method_missing': undefi ...

The CSS for the page is failing to load due to a basic HTML and JavaScript file

I'm embarking on a journey to learn HTML, CSS, and JavaScript by creating a basic webpage. Despite linking my CSS file in the HTML document, I am facing an issue where none of the styles are being applied. I am currently running this project locally ...

Is it possible for me to use an image as a grid item?

I have a grid with 3 elements as shown below: Now, I am looking to replace the blue elements with images (they can be just placeholders). .grid-container { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(30em, auto); justi ...

What is the best way to bring a single object from Django into an HTML template?

Currently, I am working on a Django website project that involves two models: Gifi (which contains .gif images) and Categorite. My goal is to navigate to another HTML template with specific image information when a .gif image is clicked. Although I have ma ...