Are you able to choose the nth element within a Bootstrap column class in order to generate columns of varying sizes?

Is it possible to access the nth element of a column in Bootstrap v4.6 to change its size? I am looking to have 2 cards with unequal columns on the top and 2 cards with unequal columns on the bottom.

<!doctype html>
<html lang="en">
<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- Bootstrap CSS -->
  <link href="main.css" rel="stylesheet" type="text/css"> 
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" />
  <link rel="preconnect" href="https://fonts.googleapis.com"> 
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 
  <link href="https://fonts.googleapis.com/css2?family=Arvo&family=Nunito&display=swap" rel="stylesheet">
  <title>Card Mockup</title>
</head>

<body>


    <!-- Cards w/ button below text-->

      <div class="container">
    <div class="row">
           <div class="col-sm-6 col-md-6 col-lg-4 d-flex">

            ...

CSS code:

$theme-colors: (
"primary": #0074d9,
"danger": #ed1c24
);

...

/* changing components of header h3 & p for smaller screen sizes */ 

@media (max-width: 575.98px) {

.card-text { 
font-size: 16px;
}

}

Image reference for desired card layout: https://i.sstatic.net/bvvmj.png

The goal is to have 4 cards where the first one takes up about 67% of the page, the second one takes up about 33%, the third one takes up 33%, and the fourth one takes up 67%. When adding new sections, they should fill the larger section first before moving to the smaller sections.

Answer №1

Consider incorporating Bootstrap breakpoints into your design strategy. You could structure it with 2 rows, each containing 2 columns.

For example:

col-9 and col-4 (total of 12) and for the bottom row: col-4 and col-9.

Explore more about Bootstrap grid system here

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

Tips on how to personalize the print layout of an Angular 4 page when pressing ctrl+p

I am working on an angular4 app and I encountered an issue when trying to customize the print page view by pressing ctrl+p in the browser. The page that needs to be printed contains only Angular components, and my attempts to modify the print view using ...

Tips for changing font styles using Polymer

I'm new to working with Polymer.js and CSS. My goal is to have text in todo.item display normally when todo.done is false, and with a line-through style when todo.done is true. I'm considering using CSS for this task, but I'm unsure how to ...

What is the best way to implement an if-else structure in this code?

Can anyone help me with converting this code into an if/else statement? I want it to display certain content if 'Rental' is true, and other content if it's false. The PHP tags are making it difficult for me to follow. <?php if( get_ ...

Generating a fictional list of items in a sequential order

I am managing a website that focuses on displaying the line of succession to the British crown. The main content of the site is structured as an ordered list using the <ol> tag. However, there is a unique challenge. Individuals occasionally drop out ...

Why can't we use percentages to change the max-height property in JavaScript?

I am currently working on creating a responsive menu featuring a hamburger icon. My goal is to have the menu list slide in and out without using jQuery, but instead relying purely on JavaScript. HTML : <div id="animation"> </div> <button ...

A tag that does not adhere to the background color's rgba opacity restrictions

Can you believe what's happening to me? Check out this code snippet. I'm trying to apply an rgba color to my a tag, but it's acting like an rgb color instead of the intended rgba. The text background is solid, but the rest of the background ...

Sliding a division using Jquery from the edges of the browser's window

<script> $(function(){ $('#right_image1').hide().delay('10000').fadeIn('5000').animate({right: '0'}, 5000); $('#left_image1').hide().delay('10000').fadeIn('5000').a ...

Tips for converting HTML content into a properly formatted text file

I have a user interface where users can perform various actions using ajax calls. Once the ajax call is completed, the results are displayed in a div with an id = "log". I want to provide users with an option (a button labeled Export) so that when they hav ...

Is there a way for me to retrieve the widths of all child elements within an HTML document?

I have been working on a JavaScript (jQuery) function to calculate the maximum width of all child and children's-child elements within a specific div element. Here is the code I have written so far: function setBodyMinWidth(name){ var max = 0; $(nam ...

Is there a similar function to -moz-linear-gradient in Chrome?

My button's CSS includes background: -moz-linear-gradient(center top, #59a1d8, #27247D) repeat scroll 0 0 #0f78c7;, which works well in Mozilla Firefox. However, it does not display properly in the Chrome browser. Can someone suggest an equivalent cod ...

Streaming live video on the website

Hi there! I'm looking to integrate live video capturing into an HTML/JavaScript site for a presentation. However, I'm not sure where to start my search. Can anyone point me in the right direction? :) The live video will be captured by a camera o ...

Using a form generated on the fly for submission

Recently, I created a dynamic form that consists of select options and input boxes. Upon submitting the form, I require all data from the selects and inputs to be stored in separate variables. The following is an excerpt from the code: HTML CODE : < ...

The functionality of nth-child(odd) seems to be malfunctioning when there is a change

When I group certain elements together in one container, I like to make odd elements stand out by giving them a different background color. However, when I try to filter elements based on conditions and move unwanted elements to another class, the nth-chil ...

How can I dynamically update an img src using JavaScript on a PHP webpage?

I have a PHP page where I display image thumbnails. I am trying to implement a feature where the thumbnail expands in another image on mouseover. Here is the PHP code snippet: echo "<tr><td><a href='$imgrow[location]' target=&ap ...

Dropdown selection returning the text value instead of the designated value

Is it possible to retrieve the text "Region 1" instead of just the value '1' from a dropdown menu in PHP? <select name = 'region' id = 'region'> <option value = '1'>Region 1</option> <select&g ...

The sequence of CSS and deferred JavaScript execution in web development

Consider this scenario: you have a webpage with a common structure in the <head>: <link rel="stylesheet" href="styles.css"> // large CSS bundle <script defer src="main.js"></script> // small JS bundle with defer attribute There is ...

Searching in Python Django with multiple attributes involvedUsing multiple attributes for

My search form consists of three fields: [Doctor][Specialty][City] Below is the HTML code for the form: <form data-provide="validation" data-disable="true" class="input-glass mt-7" method='POST' action='annuaire/'> ...

Create a copy of a div element once the value of a select element has

After modifying a select option, I'm attempting to replicate a div similar to the example shown in this link: http://jsfiddle.net/ranell/mN6nm/5/ However, instead of my expected lists, I am seeing [object]. Any suggestions on how to resolve this issue ...

Conceal the sidebar once user is logged in

I need a dynamic webpage; upon loading the login page, the sidebar should be hidden and the login page should occupy the full width of the page. Once the user successfully logs in, the sidebar along with all components should be displayed. I've attemp ...

Error message: The function curl_init() is not defined and cannot be called in the specified file path on line number 102

In the process of creating a fresh project focused on Event Management, I am in need of setting up OTP verification for mobile numbers of users registering for the event. I have been utilizing the textlocal API to send out the OTPs, however, encountered ...