What is the reason for having a column that relies on another in Bootstrap 4?

I am facing an issue with my web application.

Explanation: The text displayed on the left side is directly related to the size of the image on the right. I need a solution to make one column completely independent from another.

<section class="section">
    <div class="container">
      <div class="row">
        <div class="col-md-6 col-sm-4 col-xs-4 p-4">
              <h1>nosfera.app</h1>
              <p>Oops, looks like you have wandered into Nosfera's mysterious realm.
              <p>But fear not! We will provide royal treatment and bring you into the spotlight, all you need to do is embrace the darkness by clicking on one of the buttons below.
              <div class=fields>
                <div class=item><a href=/login><button class="btn btn-red">Log in</button></a></div>
                <div class=item><a href=/login><button class="btn btn-grey ml-2">Register</button></a></div>
              </div>
        </div>
      <div class="col-md-6 col-xs-4 col-sm-4">
        <div class="block"></div>
      </div>
    </div>
  </div>
  </section>

.section {
  display: grid;
  height: 90vh;
  align-content: center;
}
.section p {
    font-weight: 400;
    font-size: 1.2rem;
}

.block {
background:url(../img/block.png);
background-size:contain;
background-repeat:no-repeat;
background-position:center;
width:100%;
height:100%
}

Demo

Answer №1

When applying height:100% to the .block element in CSS, it will automatically adjust its size based on the content. To prevent unlimited growth, consider setting a fixed size (such as 100px) or using the max-height property.

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

Can you explain the purpose of the search_/> tag used in this HTML code?

I came across this code snippet while working on creating a customized new tab page for Firefox. <input class="searchBar search_google" type="text" name="q" placeholder="Google" search_/> However, I'm confused about the search_ ...

Tips for maintaining an exposed dropdown menu in the following page?

I'm working with a dropdown that contains <a> tags and is initially set to be hidden. There's also a caret next to the dropdown that rotates down when the dropdown is open. What I'm trying to achieve is keeping the dropdown open (caret ...

Set the background color of the list item to a color that I choose

I am dealing with colors on my server side. I have a list structure in place. When loading the jsp, I need to assign specific colors to specific list items. The color from the server side may change and the assignment of colors to list items depends on the ...

Struggling to choose an element within $(this) despite being able to view it in the $(this) outerHTML

I have a question regarding jQuery 1.12. I am attempting to target an element within $(this). $(".select").bind('keydown', function(event) { elt = $(this)[0]; console.log(elt.outerHTML); elt = $(this)[0].search("li") console.log ...

What steps should I take to eliminate the gap between two side panel components?

Let's take a look at the concept I am working on: https://i.sstatic.net/RyQAB.png I'm aiming to extract the statistics element within the red outline. The spacing issue between the stats and balance panels perplexes me. To align these panels to ...

What is the best way to update the div id by extracting the last digits from a number?

Is there a way to change the div ids using a function? Before: <div id="a_1">a1</div> <div id="b_1">b1</div> <div id="c_1">c1</div> <div id="d_1">d1</div> <button onclick="change()">Change</button& ...

Ways to resize column widths in tree views on Odoo version 10?

I have been struggling to adjust the column width of the columns in my tree view. I have attempted a few different solutions: Trying to change the width attribute in the field tag: width="100px" or width="15%%" Using the style att ...

Issue with the close button formatting in the React Bootstrap 4 modal window

In my quest to create a modal window in ReactJS using Bootstrap 4, I encountered an issue with CSS formatting for the close button. Interestingly, Bootstrap 3 worked fine with the CSS. You can check out my code here. Any advice would be greatly apprecia ...

Creating nested tabs using vanilla JavaScript, no need for jQuery

I am currently working on implementing tabs using a JavaScript function. The issue I am facing is that when I try to have tabs within one of the tabs, everything disappears every time I click on one of the inner tabs. This happens because the JavaScript fu ...

List of pictures displaying solely the initial image

While working on a jQuery sliding list to display a series of images one after the other, I encountered an issue. When manually testing the movement of an image to reveal the next one, it wasn't displaying correctly and the reason behind this is eludi ...

Sharing resources between different origins and the file:// protocol

I have been developing an HTML5 application that is collecting data from various sources using JSONP. So far, everything involving a GET request has been functioning perfectly. However, I have encountered a hurdle while attempting to make a POST request. T ...

js The correct value is not being set to the div's style.top

function gamestart(){ var gr; var gr = true; console.log(gr==true); if(gr == true){ console.log("we have activated pointer key detection dear Mr.ketsebaot") document.onkeydown = checkk; } } function checkk(e){ cons ...

Easily transform your Twitter Bootstrap menu dropdown to appear on hover instead of click with this simple solution

Is there a way to make the toggle dropdown button display the dropdown menu when hovering over it instead of clicking? I tried using the Bootstrap method $().dropdown('show'). What are your thoughts on this approach? $(document).on("mouseenter ...

Switching a div class in Angular 6 with a button click: A step-by-step guide

In this scenario, I have a div with the class name old. There is also a button that, when clicked, should toggle the div's class name between old and new. I am looking for a solution using Angular 6. Below is the code snippet: I am relatively new to ...

Ways to stop two JavaScript files from running at the same time

After combining two JavaScript files, I am facing some issues. The first file handles validation while the second one has an ajax plugin for form submission after validation. When I include these files in the header section, they both run simultaneously. H ...

Is there a way to determine the quantity of items within a sortable div?

In my HTML document, there are multiple divs containing smaller divs that can be rearranged within each other. Upon loading the document, a random assortment of these smaller divs are added to #boxtop. Below is a snippet of my HTML code: <html> &l ...

Need assistance posting on Twitter? Utilize PHP for a solution!

I'm attempting to share a user-generated and dynamic URL on Twitter, but I'm having trouble with the encoding... <a href="http://twitter.com/?status=[urlencode('I'd like to borrow this item @neighborrow')].">TWEET THIS REQUE ...

Each time I load the page, it displays differently depending on the browser. I'm struggling to understand the reason

Trying to figure out how to make the navigation bar close when a link is clicked and directed to a section instead of a new page. When on a large screen, I want the nav bar to remain open but automatically close when on a small screen (for example, when th ...

Creating a collapsible accordion feature with jQuery using a specific HTML layout: wanna learn how?

I am looking to create an accordion effect with the structure provided below. The goal is to have the corresponding article toggle when clicking on .booklist>li>a, allowing only one article to be open at a time. Can someone assist me with writing thi ...

Data not shown in original file display

I have just begun experimenting with Sencha's ExtJS. When we view the source file, it only shows the written code and does not display any applied styles or scripts that were added later in the "View Source." The same goes for AJAX; when we load cont ...