What is the best way to align content to the right of an image within a card using bootstrap?

I'm struggling to position the content on the right side of an image in a card below the image using bootstrap and CSS. Despite searching online and in the bootstrap documentation, I haven't been able to find a solution to my issue. When the screen size becomes smaller, I simply want the AppName, Description, and AppDescription to be positioned below the image. Any help would be appreciated.

Below is the HTML code:

<div class="card">
    <div class="row no-gutters">
        <div class="col-auto col-md-6">
            <img src="img/image.jpg" class="img-fluid image" alt="PayCloud App Demo" width="620" height="465">
        </div>
        <div class="col">
            <div class="card-block px-2">
                <p class="card-title AppName">AppName</p>
                <p class="card-title Description">Restaurant Payment Service - January 2020</p>
                <p class="card-text AppDescription">App Description.</p>
                <a href="link.html"><span class="button">View Project</span></a>
            </div>
        </div>
    </div>
</div>

CSS styles used:

.AppName{
    font-family: itc-avant-garde-gothic-pro,sans-serif; /* ITC Bold */ 
    font-weight: 700;
    font-style: normal;
    font-size: 42px;
    margin-top: 10%;
    margin-bottom: 0;
    text-align: left;
    font-size: 42px;
    width: 50%;
    margin-left: 5%;
    opacity: 80%;
}

.Description{
    color: #869FC9;
    width: 60%;
    margin-left: 5%;
    margin-top: 0;
    margin-bottom: 5%;
}

.AppDescription{
    opacity: 87%;
    width: 90%;
    margin: auto;
    font-family: realist, sans-serif;
    font-weight: 400;   
    font-style: normal;
    font-size: 18px;
    margin-bottom: 2%;
}

Answer №1

If you're looking for information on @media in CSS, check out the following link: Click here.

Answer №2

I managed to resolve the issue by updating the "col" class to "col-auto" and also incorporating "col-md-6" into the class attribute

See modified code snippet below

<div class="card">
        <div class="row no-gutters">
           <div class="col-auto col-md-6">
               <img src="img/image.jpg" class="img-fluid image" alt="PayCloud App Demo" width="620" height="465">
           </div>
           <div class="col-auto col-md-6">
             <div class="card-block px-2">
                <p class="card-title AppName">AppName</p>
                <p class="card-title Description">Restaurant Payment Service - January 2020</p>
                <p class="card-text AppDescription">App Description.</p>
                <a href="link.html"><span class="button">View Project</span></a>
             </div>
          </div>
       </div>
</div>

Answer №3

Bootstrap showcases a prime example of the horizontal card layout, where the image moves to the top at a specific size breakpoint.

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card mb-3" style="max-width: 540px;">
  <div class="row no-gutters">
    <div class="col-md-4">
      <img src="..." class="card-img" alt="...">
    </div>
    <div class="col-md-8">
      <div class="card-body">
        <h5 class="card-title">ExampleName</h5>
        <p class="card-text">Sample Content - Month Year</p>
        <p class="card-text ExampleDescription">Example Description.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </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

Using either the <h1> or <p> tag within my <div> element disrupts the entire layout

Whenever I add a heading tag or paragraph tag within my div, it causes the content to drop down the screen significantly. I am unsure of the cause and feel a bit overwhelmed by it. I attempted to wrap the <h1> tag in a <div>, as shown below: & ...

Issue with jQuery: CSS variable causing container misalignment

Could someone please explain why this code is not functioning correctly? var leftPos = (10 * 20) + "px"; function setPosition() { $("#Position5").css('left','(' + leftPos + ')'); } window.onload = function() { setPositi ...

The Bootstrap navbar refuses to stick without a specified width

Trying to make a twitter-bootstrap navbar sticky in the middle of content. Using the sticky jquery plugin, found on its Github page. According to the Github page, sometimes a fixed width is needed for sticky elements: "In some cases you might need to ...

"What is the best way to display an image from a table and then enlarge it to full size when a button is clicked, all

1. Understanding the Concept In my page, I have a table listing various images with unique names that are successfully displayed in the table. My goal is to display the selected image in full screen within a popup window when a button is clicked. 2. Que ...

Static checks do not apply to CSS variables

Our webtech class assignment is to create a static webpage that meets the criteria of the jigsaw w3c css validator. We've encountered a roadblock while trying to resolve the final warning message: Due to their dynamic nature, CSS variables are curre ...

`Is there a way to conceal a div class when the input id value is not filled in?"`

I've hit a roadblock with this issue that's been troubling me for days. I would greatly appreciate any assistance in solving it. Working on a Wordpress theme, I have an options panel where users can input their Twitter username. My goal is to di ...

What is the computed value of HTML and body?

Is there a specific reason why the body tag has a default margin while HTML does not? Could there be any practical explanation for this design choice? ...

activate hover interactions across multiple layers of elements

On my webpage, I have a grid of hidden images that fade in when the mouse hovers over them. The code for this functionality is as follows: HTML <img class="Image" src="./img/foo.png"> CSS .Image { opacity: 0; } JS $(".CircleImage").hover( funct ...

Can you tell me the name of this specific page arrangement style?

What is the term for the specific layout style used on Asana's homepage? This layout consists of a single, long page divided into sections that are approximately the size of the viewport. While sometimes it includes parallax scrolling, in this case i ...

Adjusting the image height to match the container height while preserving its original aspect ratio

Is there a method, using CSS alone, to adjust an image's height to fit its container while preserving aspect ratio and allowing the overflow of width to be concealed? It may seem like a complex set of requirements, but is it achievable? Essentially, I ...

What is the best way to delete a CSS class from a specific element in a list using React?

I need to implement a functionality in React that removes a specific CSS class from an item when clicking on that item's button, triggering the appearance of a menu. Here is my code snippet. import "./Homepage.css" import React, { useState, ...

Can a column in ReactJS be protected from sorting or excluded from the sorting process?

Currently, I am new to ReactJS and working on a project that involves using a Data Table library that I found here: react-data-table-component My goal is to prevent the first column from being re-arranged or sorted once other columns have been clicked f ...

Auto play feature malfunctioning in Onsen-UI Carousel attribute settings

When utilizing onsen UI in my mobile web application, I encountered an issue with the autoplay property not functioning properly within the carousel. <ons-page> <ons-toolbar> <div class="left"> <ons-toolbar-button on ...

How can you leverage Beautiful Soup to extract data from a specific CSS class on a webpage?

In the process of scraping this html with code, my main objective is to extract the link from it using Selenium driver. html = driver.page_source soup = BeautifulSoup(html) file_link = soup.select(".inpfilelink") return file_link print file_upload("/hom ...

Problem arises when the DIV elements are not expanding horizontally together

Struggling to create a round corner box using divs. I have been working on it all day and can't figure out what I'm missing. If anyone could help me spot the issue, that would be great. I want the 'header' and 'footer' to exp ...

The ng-bootstrap modal fails to appear when incorporating [formGroup]="FormName" or formControlName="elementName"

Utilizing ng-bootstrap to create a popup modal has been a challenge for me. When I import FormsModule and ReactiveFormsModule in src/app/modal-basic.module.ts, the code inside it looks like this: import { NgModule } from '@angular/core'; import { ...

What is the best way to vertically center align forms?

Just a heads up, I've already tried using vertical alignment methods and they didn't work. So, here I am posting my problem. Sorry if it's a trivial question, but I'm really struggling with it. <div class="container-fluid"> < ...

Arranging data points into one concise column

Important Note: The code above has been automatically generated by JavaServer Faces. I am working with the following code snippet: <span style="display: block;"> <input checked="checked" type="checkbox">ID <select size="1" &g ...

What is causing the error message stating that the DateTime class object cannot be converted to a string?

I found this code snippet on a programming forum function increaseDate($date_str, ${ $date = new DateTime($date_str); $start_day = $date->format('j'); $date->modify("+{$months} month"); $end_day = $date->format(&apo ...

Require assistance with displaying a menu on a website using JQuery

Is there a way to create a menu similar to the one shown in the image below?https://i.sstatic.net/QxNPL.png To learn more about this menu, you can visit their website by clicking on this Link. I have copied some code (HTML code and links to CSS and .js fi ...