Adjustable div element and percentage-based height are not functioning correctly

I am facing a minor issue while attempting to create a responsive div with an image background.

  1. The div does not match the size of the image: 540px-290px
  2. When I resize the browser, the two divs do not resize together.

In each div, there is a background image and I want them to be responsive. However, both divs do not cover the full size as I am using percentages for responsiveness. If I switch to pixels, it will lose its responsiveness.

This is how my div should look like: https://i.sstatic.net/XfzZD.jpg

I am utilizing the Bootstrap framework.

HTML

<div class="row index-banner">

  <div class="col-xs-6">
    <div class="latest-mobile">
      <h1> releases?</h1>    
      <p>We got you </p>
      <p>Find out more ></p>
      </div>
  </div>

  <div class="col-xs-6">
     <div class="sponge-bob">
      <h1>We have just ....</h1>
      <p>Let your kids enjoy .</p>
      <p>Find out more ></p>
      </div>
  </div>

</div>

CSS

html,
body {
  width: 100%;
  height: 100%;
}

.col-xs-6 .sponge-bob {
  background: url(../../public/images/content/sponge-bob.jpg) no-repeat;
  margin-left: 5%;
  width: 100%;
  height: 100%;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;
  display: table;
  position: relative;
}

.col-xs-6 .latest-mobile {
  background: url(../../public/images/content/latest-mobile.jpg) no-repeat center center scroll;
  margin-left: 7%;
  width: 100%;
  height: 100%;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;
  display: table;
  position: relative;
}

Answer №1

Here is a potential solution for you

.newest-mobile,
.patrick-star {
  min-height: 290px;
}

Answer №2

One solution could be to specify a minimum height by Adding the following CSS rule: min-height: 100%;

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

Is there an issue with the padding not functioning correctly on smaller and medium-sized devices when using Bootstrap

On my desktop, I added '50px' padding to the body of my page and it's working properly. However, on smaller and medium screens, it's not functioning correctly. I tried using Bootstrap @media CSS functionality, but it still doesn't ...

Utilizing aliases for CSS/SASS file imports with webpack

Can we use aliases to import .scss / .css files? // webpack.config.js resolve: { alias: { styles: path.resolve(__dirname, "src/styles/"), } } In the main.js file: // main.js import "styles/main.scss"; ...

Difficulties experienced when attempting to position content following the conversion from flash to html5

Before, I used a flash file within a tag to center it on my Wordpress Website. Now that I have converted it to html5 to serve content to Android browser users, I'm having trouble aligning the content in the center of the page for both Desktop and Andr ...

What methods can I use to adjust the selected option according to the value in the database?

To introduce you to my work, I have a table filled with data from a database that functions as a CRUD - Create, Read, Update, Delete table. Within this table, there is a column where EDIT and DELETE buttons are located. Clicking on the EDIT button trigger ...

Seeking guidance on traversing a nested list with JQuery

I'm facing a rather simple issue, yet I've spent countless hours trying to resolve it without success. The goal is to show a nested list whenever a parent list item is clicked. Here's the jQuery code: <script type="text/javascript"> ...

Utilize PHP to create HTML permalinks for optimal linking functionality

I am experiencing an issue with HTML and PHP combination. Here is the code snippet causing trouble: $args = array( 'post_type' => 'program', 'posts_per_page' => 100 ); $loop = new WP_Query( $args ); while ( ...

Tips for utilizing Bootstrap 4 exclusively within a designated Bootstrap Modal

Currently, I am working on an application that utilizes Bootstrap 3. Unfortunately, the Bootstrap 3 files (.css/js) have undergone extensive modifications. My task involves integrating the SummerNote Text editor, and although everything is functioning corr ...

What is the correct way to utilize the submit() function within this specific form?

I have a small registration form that requires validation before submission. In order to achieve this, I've developed a JavaScript function as shown below: var name = document.getElementById('name').value; var company = document.getElem ...

CSS background property does not function properly if the URL contains brackets

Here is the URL for an image I am working with: URL: Currently, I am having an issue in my CSS: background: url(http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-(1)-340x340.jpg) The problem arises due to the presence of ...

Different ways to adjust the height of the date picker in Material UI

I am attempting to customize the mui date picker, but I am facing issues with applying CSS styles to it. I have tried using both inline styles and external styling by assigning classes, but nothing seems to work. I specifically want to adjust its height. ...

Creating line breaks for ToolTip titles in Material-UI can be achieved by using the appropriate syntax and

I am currently working with the ToolTip component and I have a query regarding displaying two lines for the title text - one line for each language rather than having them displayed on a single line. Is it possible to achieve this and how can I style the c ...

How to properly store response text in JavaScript variable?

Utilizing Ajax to execute a PHP script on my website, I aim to assign the response from the PHP script to a JS variable. The objective is for this script to set the variable "stopAt" to 42. This is where I encountered an issue: Below is the code snippet ...

Unable to use column formatting on a row using flexbox

I am working on creating a layout with rows and columns where the content in each column is vertically aligned. Here is an example of what I am trying to achieve: Currently, I am using react and have multiple components. The approach I believe will work ...

Extract the text from an html element by utilizing xpath

This snippet contains HTML content <p class="ref Hover"> <b class="Hover Hover Hover Hover Hover">Manufacturer Part Number:</b> MC34063ADR2G<br> <b>Mounting Method:</b>&nbsp; Surface Mount& ...

When the flexDirection is set to row, Material-UI input labels will appear outside of

Currently, I am facing an unusual situation. In my code, I have incorporated 2 div elements within a FormControl, and everything appears to be working correctly with the input label for the Select. However, when I apply styling with flexDirection: 'ro ...

Customizing the color of the thumbs on a Material UI range slider

Hey there, currently working on creating a range slider with 2 values using the material UI slider component. My goal is to customize the two thumbs with different colors. https://i.sstatic.net/BUq12.png Any ideas on how I can achieve this? ...

Turn off the scroll bar and mouse wheel functionality, while still allowing for scrolling

Is there a way to hide scrollbars on a website, prevent scrolling by mouse but still allow access to hidden areas using the jQuery scrollTo plugin function? (e.g. clicking on a button to scroll to a specific element) Thank you! ...

Tips for achieving a static background image while allowing scrolling on a webpage in asp.net

I am struggling to implement this on my website. The background image needs to be fixed while the content of the webpage should scroll in asp.net <head runat="server"> <title></title> <style type="text/css"> body { backgr ...

Tips for preserving session on an Atheros board with C programming to access a website

Currently, I am utilizing the Atheros development board with LSDK-9.2.0_U10.5.13 stack and mips-linux-2.6.31 Linux version. On the board, I have c file, html, js, and css files, without utilizing the cgi library or any scripting language like php. My curr ...

Choose an input that is not grouped with the rest

I am facing an issue where I need to group these three inputs together as one continuous form. However, there seems to be a problem with the select input not aligning correctly with the rest of the form. Is there something that I might be doing wrong? & ...