Encountered an issue retrieving two rows nested within a parent row using Bootstrap 4 and VueJs

Currently, I am working on a VueJs and Bootstrap4 component where my aim is to achieve a design similar to the one shown using the available bootstrap classes.

After going through the documentation, I came across the customized classes h-75 and h-25 provided by Bootstrap. Despite using these classes, I am unable to achieve the desired outcome.

Vue.component('listcontent', {
  template: '<div class="w-100 h-75 bg-info">ds</div>'
})

Vue.component('datashared', {
  template: ' <div class="w-100 h-25 bg-primary">dsadsa</div>'
})


Vue.component('maincomponent', {
  template: `<div class="container h-100" >
        <div class="row h-100">
            <div class="col-md-5 h-100 border">
                <listcontent></listcontent>
                <datashared/></datashared>
            </div>
        </div>
    </div>`
})

new Vue({ el: '#app'});
html,body {
  height: 100% !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5b2d2e3e1b69756e756a6a">[email protected]</a>/dist/vue.js"></script>


<div id="app">
  <maincomponent></maincomponent>
</div>

I'm looking for some guidance on what might be going wrong and how I can achieve the desired result in my project.

https://i.sstatic.net/yGvBP.png

Answer №1

Ensure that the id app element also has a height of 100%

html,
body,
#app {
  height: 100% !important;
}

Vue.component('listcontent', {
  template: '<div class="w-100 h-75 bg-info">ds</div>'
})

Vue.component('datashared', {
  template: ' <div class="w-100 h-25 bg-primary">dsadsa</div>'
})


Vue.component('maincomponent', {
  template: `<div class="container h-100" >
        <div class="row h-100">
            <div class="col-md-5 h-100 border">
                <listcontent></listcontent>
                <datashared/></datashared>
            </div>
        </div>
    </div>`
})

new Vue({
  el: '#app'
});
html,
body,
#app {
  height: 100% !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0274776742302c372c3335">[email protected]</a>/dist/vue.js"></script>


<div id="app">
  <maincomponent></maincomponent>
</div>

Answer №2

h-100 sets the height to 100%, which takes the height of its parent element. If there is no parent, you need to specify a fixed height. I wrapped the entire HTML content in a div with a height of 100vh, which equals the window height.

Since I am not familiar with using vue, I created this as pure HTML. You can place your components accordingly.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div style="height:100vh">
<div class="container h-100">
  <div class="row h-100">
    <div class="col-md-5 h-100 border">
      <div class="w-100 h-75 bg-info">ds</div>
      <div class="w-100 h-25 bg-primary">dsadsa</div>
    </div>
  </div>
</div>
</div>

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

The appearance of the page varies between Ubuntu and Windows 7 when viewed on Firefox 31

This situation is completely new to me: The page I designed appears differently on Firefox 31 in Ubuntu (correct): compared to Windows 7 (wrong): I was able to replicate this issue on another Windows 7 machine using FF 31. My HTML and CSS both validate w ...

How can Vue.js be used to generate an href link from Vue data response and transmit it to the following request?

After researching on Google for a solution to my problem, I came across this answer. However, it did not work in my case. Let me provide an example from the project I am currently working on, which is developed in Laravel. The following code snippet is fr ...

Tips for executing a function in the HC-Sticky plugin?

Currently, I am utilizing the HC-Sticky JavaScript plugin and endeavoring to utilize the documented reinit method. However, I am facing difficulty in understanding how to execute it. In this CodePen demo, a basic setup is displayed along with an attempt t ...

How can you set an input field to be initially read-only and then allow editing upon clicking a button using Vue.js?

//I have two divs that need to be set as readonly initially. When an edit button is clicked, I want to remove the readonly attribute and make them editable. <div> <input type="text" placeholder="<a href="/cdn-cgi/l/email-protection ...

Implementing unique functionalities based on whether the link is clicked an odd or even number of times

Three student names are listed as links. When a link is clicked for the first time or odd number of times, a div containing details about that student appears. Clicking the same link for the second time or even number of times hides the student div. This f ...

Use HTML to showcase an image that dynamically changes based on the outcome of a query function

Hello there, I hope my inquiry is clear enough. I apologize for reaching out as I am unsure where to begin and what exactly I should be focusing on. Currently, I have an image displayed in an HTML page like this: <div id="tag_sunrise_sunset"><p ...

The functionality of Vue Routes is compromised when deployed to a live environment

Hello, I am a newcomer to Vue.js. I am facing an issue with my Vue.js application where I am unable to access the URL '/foo/apple' on the web hosting server after running "npm run build". It keeps showing error 404. I am using HTML5 History Mode ...

The images on my website are not displaying properly on different devices

My attempt at creating a website for fun and testing purposes is facing issues when viewed on mobile devices. The images and specially positioned elements are not displaying correctly, extending beyond the page boundaries. I have tried adding the viewport ...

Smoothly transition the box shadow using CSS3's ease-in and ease-out effect

Struggling to achieve a smooth easing effect for a box shadow transition using CSS3. This is the current CSS code in use: #how-to-content-wrap-first:hover { -moz-box-shadow: 0px 0px 5px #1e1e1e; -webkit-box-shadow: 0px 0px 5px #1e1e1e; box-s ...

Adjustable Bootstrap Progress Bar - Modify element width on the fly

I have encountered an issue with my progress bars on the webpage. The static HTML version works perfectly fine, but the dynamically created one using jQuery seems to be instantly at 100% without any delay in progression. To illustrate the problem better, ...

Launching a modal by passing data in an MVC environment

I am struggling with a task where I have a list of objects, and upon clicking on any of them, I want a modal to open displaying the data of the clicked object. Despite thinking it would be simple, I just can't seem to get it to work. My goal is to pas ...

encountering difficulty incorporating menu.php within main.php

I'm currently working on integrating the menu.php file into my main.php. Here is what I have accomplished so far: Main.php <html> <body> <?php include("menu.php"); ?> <p>This is an example to demonstrate how ...

Vue.js and Laravel API working together to display user information along with posts

Currently, I am in the process of learning Vue.js with an API built using Laravel. The concept is quite simple: a user can create a post, and each post can have comments. While I've been successful in establishing relationships within Laravel, I' ...

Sometimes in VueJs, the global data that has been loaded may become null

Hello, I am currently exploring VueJs and looking for a way to load data once and share it across all Vue components. I've encountered an issue where global variables sometimes become null unexpectedly. In my main.js file, I have defined three global ...

Error Encountered: Anticipated 'styles' to consist of a series of string elements

I have attempted various solutions for this particular error message without any success. When launching my angular project using the angular cli via ng serve, everything runs smoothly with no errors. However, upon compiling it with webpack, I encounter th ...

jquery-enhanced tabs with versatile functionality

HTML: <ul class="tabs"> <li><a href="#tab-one" class="current">Residential</a></li> <li><a href="#tab-two">Commercial</a></li> <li><a href="#tab-three">Agricultural</a></li> < ...

Enhancing Visuals within XSL+XML Documents

Currently, I am working on a project for one of my classes that involves showcasing film information loaded from an XML document. While researching similar questions, I found the answers to be confusing and the solutions did not yield any results. My goal ...

Handling Website Downtime with PHP Simple HTML DOM Parser

I have been extracting data from a government website for health updates in Turkey. However, if the site experiences downtime or fails to load, my own website stops displaying any content after fetching and parsing the news. Is there a way to optimize th ...

Is it possible to retrieve the complete file path in a form?

My goal is to retrieve a file using an input element of type "file". This element is located within a partial view, and I need to send it to the controller or request it there using "Request.Form["inputFile"];". However, this method only provides me with t ...

Learn how to incorporate a consistent header and footer across multiple pages on a website with Node.js, ExpressJS, and either hbs or ejs templates

Creating a common header (navbar) and footer page to be included in multiple/several pages of a website. I want to create a dynamic website using Node.js and Express.js. The code for the navbar and footer will be placed in a common file named header.html ...