What is the best way to position this element in the center with a background image using CSS and Bootstrap?

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

my code

<div style="background-image: url('{{ asset('img/background-line.svg') }}')">
    <div class="row my-10 justify-content-center">
        <div class="col-auto">
            <div class="card border-0 rounded-0 rounded-top">
                <div class="card-body py-5">
                    <ul class="breadcrumb my-0 fs-5 breadcrumb-transparent font-weight-bold p-0">
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted"><i class="fa fa-home"></i></a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Layanan Investasi</a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Sektor Aneka ET</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

how do I center this and apply a background image using CSS Bootstrap so that the breadcrumb is fixed in the center?

Answer №1

Make sure to use

class="card-body mt-5 p-0"
instead of class="card-body py-5"

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="492b26262d3a3d3b2839097d677f6778">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>

<div style="background-image: url('https://www.freecodecamp.org/news/content/images/2021/06/w-qjCHPZbeXCQ-unsplash.jpg')">
    <div class="row justify-content-center">
        <div class="col-auto">
            <div class="card border-0 rounded-0 bg-transparent">
                <div class="card-body mt-5 p-0">
                    <ul class="breadcrumb my-0 fs-5 breadcrumb-transparent font-weight-bold py-3 px-5">
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted"><i class="fa fa-home"></i></a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Investment Services</a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Various ET Sectors</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

Answer №2

Check out the code snippet below. To remove the bottom border radius, you'll have to do it manually using CSS.

.breadcrumb {
  border-bottom-left-radius: 0!important;
  border-bottom-right-radius: 0!important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8bab7b7acabacaab9a898ecf6eef6e9">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>

<div style="background-image: url('https://picsum.photos/1000')">
    <div class="row justify-content-center">
        <div class="col-auto">
            <div class="card border-0 rounded-0 bg-transparent">
                <div class="card-body mt-5 p-0">
                    <ul class="breadcrumb my-0 fs-5 breadcrumb-transparent font-weight-bold py-3 px-5">
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted"><i class="fa fa-home"></i></a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Investment Services</a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="#" class="text-muted">Various ET Sectors</a>
                        </li>
                    </ul>
                </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

Proper functioning of CSS directional styles is not being achieved

Is there a way to solve the issue of word-wrap and word-break styles not working when adding direction: rtl; in CSS using Pure CSS? Note: Browser support needed for IE9+ and Chrome. #container { height: 440px; width: 150px; left: 40%; top: 20%; border: ...

Steps to add a new module to the Joomla K2 item.php file

Is it feasible to insert a new module position within the item.php file of K2? I am looking to incorporate advertisements within this module, with different ads for each category. The module should be left-aligned in the article, while the item image nee ...

Dealing with uneven column heights using Bootstrap 4's Flex feature

Currently, I am using Bootstrap 4 to create a simple 4*4 grid of divs that contain an image and some text. Initially, I tried using 6 columns nested inside a single row, but the picture wasn't centered correctly within the column. Then, I applied text ...

Creating a Dynamic Login Panel Using HTML, CSS, and Jquery

Designing a dynamic sliding login panel utilizing Html, CSS, and jquery alongside various plugins. Check it out here: http://24.125.42.135/ When activated, the bar smoothly pushes down the content (click on the login option at the top right corner). This ...

PHP/SQL Search: A Basic Solution

Hey everyone, I could really use some help with my PHP SQL HTML project. I've been struggling to get my code to run properly and I can't figure out why my html form won't display. The program is supposed to search for user input in a search ...

The essential criteria for script tag and page validation requirements

There are instances where I have pages that contain only a script without any content (such as sending data through postMessage and then closing itself). In these cases, is the page considered valid with just <script>doSomeStuff</script> or do ...

Unexpected Error: Null value prevents accessing 'getElementsByClassName' property in HTML, along with Troubleshooting Inactive Button Behavior in HTML

Can someone identify the error in my HTML code? I keep getting an "Uncaught TypeError: Cannot read property 'getElementsByClassName' of null" error on the second line of the script tag. Additionally, my implemented active header code is not funct ...

Trouble with vertical drop-down navigation

I am currently working on adapting a horizontal desktop navigation menu to be responsive. I successfully changed it to display horizontally on smaller screens, but now I am facing an issue with the dropdown submenus covering the parent items below them. Wh ...

Guide on how to reset a counter to 0 using a JavaScript button

I currently have a JavaScript counter and a button that increments the counter by 1. Here is my existing code: var counter = 0; var a = 0; var add = function(valueToAdd){ a += valueToAdd; document.getElementById('Value&ap ...

Arrange Vuetify grid columns in reverse order when the screen size breaks

I am looking to rearrange a row of columns when the screen size is reduced. Initially, I have column one followed by column two in order. However, on smaller screens, I want column two to move up and become the first column. <v-row> <v-col col ...

Having difficulty scrolling down in a section with 100% height on iOS devices

Currently facing an issue with a website I am creating for my wedding invitation. The top section is set to have a 100% height and requires scrolling to view the rest of the content. While it functions perfectly on FireFox / Chrome on my computer, there s ...

Arrange your HTML pages using the Bootstrap 4 Navigation Bar

Inquiry: What is the standard or best practice for organizing multiple HTML sites or files with a navigation bar that should be visible on all pages? Background: As a beginner in website creation, I am working on a project to run on an ESP using Bootstrap ...

A CSS rule to display a nested list on the left-hand side

I created a menu that you can view here. When hovering over "tanfa demo example," the sublist appears on the right side. The issue I'm facing is that my menu is positioned all the way to the right, which means the sublist also appears on the extreme ...

Generating HTML Document using asp.net with Internet Explorer

During my work on a tool, I encountered an issue where saving a template as an HTML file from Internet Explorer resulted in improper formatting compared to other browsers like Firefox and Chrome. This mishap led to crashes within the application. Below is ...

Struggling to locate a straightforward sidebar solution without relying on Bootstrap. Finding an easy-to-use answer seems

I have a lightweight and easy-to-understand code for a website project with two panels. The first panel on the left is a large navigation (270px width, top to bottom, similar to a wiki) with approximately 30 unordered list items. Next to it is the second ...

Is there a way to implement an onclick event for every iframe within a document using jquery?

I have a webpage containing two iframes that can be switched using a selector. My goal is to implement an onclick event that will trigger a URL for specific <rect> elements within the iframes. After reading a helpful post on accessing iframe childr ...

Struggling to design a responsive layout as the div on the right keeps overlapping the div on the left

I recently built a React component that consists of two columns. In the left column, there's a calendar while the right column contains some text along with an input and select field. However, I noticed that when I resize the window, the elements on ...

Put a variable within the echo statement

I want to include a PHP variable in the href attribute of a link within an echo statement. I'm having trouble inserting $myimage after a href="billing/", as it is not displaying anything. Here's my code snippet. $myimage = $row['image' ...

Customizing Swiper slider to display optimized images based on screen size for enhanced user experience

I am currently working on an ionic app that utilizes the ion-slides directive with a swiper slider to create an image slider. Here is a snippet of how it appears in the view: <ion-slides ng-if="slider.length > 0 && article.external_media.len ...

Ways to display closing tag in minimized code in JavaScript documents

I am encountering an issue where the closing tag of folded code is visible in my HTML file, but not in my JS files (specifically JSX syntax). I apologize if this is a trivial question, but I am hopeful that someone can assist me in making the closing tag ...