Enhance your website with Bootstrap 5's responsive rounded corners feature

Utilizing Bootstrap 5.3.1, I have successfully implemented responsive borders using the Utility API. My CSS file includes classes such as .rounded-top-sm-4 and .rounded-end-sm-4.

# utilities_custom.scss
@import "bootstrap/functions";
@import "bootstrap/variables";
@import "bootstrap/variables-dark";
@import "bootstrap/maps";
@import "bootstrap/mixins";
@import "bootstrap/utilities";

$utilities: map-merge(
  $utilities, (
    "rounded": map-merge(
      map-get($utilities, "rounded"),
      ( responsive: true ),
    ),
    "rounded-top": map-merge(
      map-get($utilities, "rounded-top"),
      ( responsive: true ),
    ),
    "rounded-bottom": map-merge(
      map-get($utilities, "rounded-bottom"),
      ( responsive: true ),
    ),
      ...

My Markup:

  <div class="card border-0 mt-5">
    <div class="row justify-content-center g-0 fs-4">
      <div class="test col-md-4 rounded-4 rounded-end-md-0 rounded-bottom-sm-0">
        <div class="card-body p-5">
          <p class="card-text">...</p>
        </div>
      </div>
      <div class="col-md-4">
        <img src="..." class="img-fluid" alt="...">
      </div>
    </div>
  </div>

Desired Outcome:

  1. For medium screens, I intend for .test to have a radius-4 on the top-left and bottom-left corners.
  2. For small screens, I want .test to have a radius-4 on the top-left and top-right corners.

Current Outcome:

  1. On medium screens, only the top-left corner has a radius-4, the other corners are radius 0.
  2. On small screens, all corners have a radius-4.

What mistake have I made? Thank you.

Answer №1

It was necessary to specify the md screen border-radius:

<div class="col-md-4 rounded-top-4 rounded-start-md-4 rounded-end-md-0">

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

What is the best way to align elements within a row/column layout in Angular Material when working with divs?

To set up two div blocks in a row, I'm utilizing the code below: <div layout="column" layout-gt-xs="row" layout-align="center center" id="row"> <div id="a">a</div> <div id="b">b</div> </div> The CSS for this ...

Focus on selecting each label within a table using JavaScript

In my current setup, I am attempting to customize radio buttons and checkboxes. Array.from(document.querySelectorAll("tr")).forEach((tr,index)=>{ var mark=document.createElement("span"); Array.from(tr.querySelectorAll("input")).forEach((inp,index ...

Find the line containing the selected text within a JavaScript code

I am working on a contentEditable div where users can enter multi-line text. I need to be able to inspect the line that the user is currently typing in when they press enter. Is there a way to retrieve the context of that specific line (or all lines)? Is ...

Tips on how to center an image within a table cell:1. Insert the image

I've been attempting to center an image within a bootstrap4 table cell, but it keeps appearing on the left and even overlaps the border. I've tried adding inline styles like text-align: center; vertical-align: middle; both to the table cell HTML ...

Creating a visually appealing Django filter form with custom styling in HTML

Currently, this is how my django filter form appears: https://i.sstatic.net/JQWFG.png Below is the html code I am using: <form action="" method="get" class="form-inline"> {{myfilter.form|bootstrap}} <but ...

Having trouble with Firefox not recognizing the linear gradient color in my CSS3 code

I'm working on implementing a linear gradient background using CSS, but I'm facing an issue with Firefox not displaying it correctly. body { height: 100%; /*background-color: #F0F0F0;*/ background-repeat: repeat-x; /* Safari 4-5, Chrome 1-9 */ ...

Guide to building a personalized 12-column CSS grid system with Flexbox technology

Seeking assistance in developing a Responsive 12 column grid system using CSS FLEXBOX to ensure my website is responsive. I am determined to create my own grid system without relying on any CSS framework, utilizing custom class names. Any tips or guidance ...

The drop-down button unexpectedly disappears when using Bootstrap in combination with jQuery autocomplete

I have some javascript code that is structured like: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI Autocompl ...

What is the best way to initiate a function upon each page load?

(Apologies in advance for any English mistakes) Hello everyone, I am currently developing a simple Chrome extension to edit certain graphics and text fields on a website (Freshdesk) that cannot be modified directly on the site due to proprietary code. ...

CSS struggles after implementing conditional checks in return statement for an unordered list

I'm encountering a CSS issue with the header section. When I include the following code snippet in my code to display a tab based on a condition, the entire header list doesn't appear in a single horizontal line: <div> {isAdmin(user) ? ...

The Bootstrap 5 class "col-md-4" seems to be malfunctioning

My goal is to create a grid layout with 3 columns and 2 rows using Bootstrap cards, but I'm encountering an issue where all the cards are centered and stacked on top of each other. Can someone please assist me in resolving this problem? Service.js co ...

Applying CSS classes to my div element

Check out the following code snippet: <div class="page-template-default logged-in"></div> I am trying to apply a class like this: .page-template-default .logged-in { } However, it doesn't seem to work. Any idea why? ...

Beautiful prompt interface for HTML

I'm attempting to create a sweet alert using the HTML option: swal({ title: "HTML <small>Title</small>!", text: "A custom <span style="color:#F8BB86">html<span> message.", html: true }); Instead of just text, ...

Is there a way for me to adjust my for loop so that it showcases my dynamic divs in a bootstrap col-md-6 grid layout?

Currently, the JSON data is appended to a wrapper, but the output shows 10 sections with 10 rows instead of having all divs nested inside one section tag and separated into 5 rows. I can see the dynamically created elements when inspecting the page, but th ...

The CSS specificity of a nested HTML element with no explicitly defined styles

Seeking clarification on this specific CSS cascading/inheritance rule. In the given example, I would have expected the text inside the em tag to be colored #000000, but I was informed that it would actually be colored #ff0000. I am familiar with CSS speci ...

Change the destination of an iFrame upon user click

Is it possible to redirect an iFrame to a different HTML page when clicked by the user? I have an iFrame that is essentially an HTML page. When I click on the iFrame, I want it to take me to another HTML page. This is my code: h1 { ...

Assigning alphanumeric characters to the axis for identification purposes

review the code in index.html <!DOCTYPE html> <html> <head> <title>D3 test</title> <style> .grid .tick { stroke: lightgrey; opacity: 0.7; } .grid path { stroke-width: 0; } .ch ...

Alter the div's HTML content once the Ajax operation is completed

I have a div element that looks like this: <div class="progress" id="progress-bar"></div> I am using the following JavaScript code along with an ajax call to retrieve some data. The data returned is 0, however, the content is not being added ...

Instructions for developing an HTML element slider using mouse dragging

I've come across plenty of slider plugins that either only allow clicking to view the next image, or if they do support mouse drag or touch capabilities, they are limited to images. Does anyone know of a plugin or method to create a mouse drag slider ...

Simple CSS and HTML trick for creating a seamless hide and hover effect

Every time I've attempted this task in the past, it has been straightforward. However, this time it's proving to be challenging. The goal is simple - have an image display a description when hovered over by a user. HTML: <div class="descript ...