Having trouble aligning items within columns using Bootstrap 4?

Even after researching and attempting solutions from previous questions, I still have not been able to achieve the desired outcome.

  1. What is the best way to align items inside columns?
  2. How can I adjust image size to perfectly fit the column width?
<section>
  <div class="container-fluid idx-sec1">
    <div class="row">
      <div class="col-5">
        <img style="width:125%" src="{%static 'images/idx-sec1-m.png' %}" alt="">
      </div>
      <div class="col-7">
        <h1> FIBLIT is leading </h1>
        <span>The future of Technology</span>
        <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. 
           Fuga placeat ratione consequatur aperiam laborum omnis ab 
           accusantium laboriosam quam debitis.
        </p>
        <button class="btn">Discover</button>      
      </div>
    </div>
  </div>
</section>
.idx-sec1{
    background-image: url(../images/idx-sec1-f.jpg);
    height: 100vh;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

Your help is greatly appreciated.

Answer №1

Ways to properly align items within columns

To ensure proper alignment, you can incorporate bootstrap classes into your row or col, depending on your specific requirements.

If you wish to align all child elements within a col:

<div class="row justify-content-center align-items-center">...</div>

Alternatively, if you want to align elements within a particular col:

<div class="col-7 align-self-center">...</div>
 //or
 <div class="col-7 text-center">...</div>

Guidelines for adjusting image size to fit column width

To make sure images adjust proportionally to the column width, utilize the img-fluid class in the ``img`` tag. For example:

<img src="" class="img-fluid" />

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

A guide on choosing a custom button color and automatically reverting to its original color when another button is clicked

I have a collection of 24 buttons, all in a dark grey (#333333) shade. Whenever I click on one of the buttons, it changes to a vibrant blue color (#0099ff), which is functioning correctly. However, when I proceed to click on another button, the previous ...

Adding a div to a different webpage using jQuery

I am currently working on a small admin panel and I was curious if it is feasible to use jQuery to add a div box inside the index.php file after clicking a button in the panel? If this is possible, an example demonstrating how to do so would be greatly ap ...

Add distinctive formatting for the final element that is not the last child

Presented with a fascinating challenge, I find myself with an ever-changing number of .child.red children. I am in need of referencing the last .child.red element dynamically using styles. Although I have attempted to achieve this on my own, I am curious a ...

What is the best way to declare a minimum and maximum date in HTML as the current date?

I have a question regarding setting the min/max date for a date input in my Angular 6 project. How can I ensure that only dates up to the current date are enabled? So far, I have attempted to initialize a new Date object in the ngOnInit function and set t ...

Set up a trigger to activate when a WordPress User Role is selected, or alternatively, execute JavaScript

Looking for a solution to detect when a new user is created with a custom User Role set to lessee. Options include adding a trigger through WordPress filters or actions, or detecting the change in JavaScript using an event listener. I have identified the ...

Ensuring the security of updated data

As I explore various websites, including SO and my own, I have noticed a common practice of storing row IDs of data retrieved from a database in an HTML attribute. This data can be manipulated by the user on the client side and potentially sent to the serv ...

Getting the draggable events area from the database in fullCalendar: A step-by-step guide

Currently, I am in the process of developing fullCalendar drag-and-drop events with a resource column. Initially, I hardcoded the draggable events area and now I am working on retrieving it from the database. Previously, the database had two tables - Resou ...

Using jQuery to close a DIV with a delay

At the top of my website, I have set up an alert with a close button. The jQuery function for closing the alert is as follows: /* CLOSE ALERT BAR WITH BUTTON */ $('a.ctp-alert').click(function () { $("div.ctp-alert").slideUp(); }); While this f ...

Is there a link outside a webpage that has Facebook connect capabilities?

Recently, I started delving into the world of the Facebook API. My initial experiment was a simple "Hello World" application that displays the logged-in username. Everything was working perfectly when I had the FB.init() function inline - the "Login using ...

Is there a glitch in the Bootstrap 4 modal system?

<html><body><div class="popup fade" id="myPopup"> <div class="popup-window popup-large" role="popup"> <div class="popup-content">Hello Popup</div></div></div> <script src="https://ajax.googleapis.c ...

Resize a container to match the height of either its children or the full height of the window

I'm seeking advice on how to properly use height: 100%. Is there a way to scale a div based on the height of the window and its content simultaneously? I want one to override the other if necessary. Here's an example of standard height 100% css ...

Retrieving information from the Header element (<H></H>) with the help of Selenium

I have a website with the following code snippet: <div class="list_item_normal"> <div class="main_content"> <div class="img_wrap"> <a href="/home/Detaljer/9781118093757"><img alt="Miniaturebillede af omslaget til Op ...

Tips on using htmlspecialchars in combination with a href:To safely include links in

If I have the following code: $text = "please visit this <a href='http://example.com'>site</a>." $text = htmlspecialchars($text); echo $text; The output will be please visit this <a href='http://example.com'>site< ...

Assigning an incorrect action to a form element

In the Kohana 3.2 documentation, there is a validation example located in the ORM directory that I would like to discuss further: <form action="<?= URL::site(**'/members'**); ?>" method="post" accept-charset="utf-8"> <label for="u ...

Evaluate the user's answers to a database using a SQLite 3 C++ Quiz

Currently, I am in the process of writing a C++ program that utilizes SQLite. The main aim is to enable users to specify their preferred hotel room options. Subsequently, the program compares these user selections with the information stored in a database. ...

How to center align a button in the footer of a Bootstrap card

I'm currently using Bootstrap 5.1.3 and facing a challenge in centering a button within the footer of a card. Below is the code snippet I am working with: CSS .btnStandard { min-width: 10vw; } HTML <div class="card-footer justify-content- ...

Transform one Scss file into CSS by utilizing the compass-watch feature

Converting Scss modules to CSS one by one manually is becoming exhausting for me. I'm looking for a way to convert my individual Scss file from multiple modules at once. Currently, I am using compass watch on the command line to compile CSS with ruby ...

Creating a customizable dropdown menu in HTML with potential Javascript integration

I'm looking to add a drop-down menu similar to an <options> tag within an HTML form. However, I also want users to have the ability to type in their own input if they choose, in addition to selecting from a predefined list of options. Essentiall ...

Ensuring the state is correctly updated upon form submission in React JS

Is there a way to reset the state to blank after submitting the form? I attempted to clear it again upon submission, but the state still retains its value. How can I revert the state back to its initial state after finishing the submission? state = { ...