Div Cards Colliding

Div Card overlap each other when I reduce the screen size on certain degree. However, once I reduce it even more, it works as intended. This is how it appears when I reduce it to the point where bootstrap can work on col-md

This presents a problem.

https://i.sstatic.net/nZkJY.jpg

This is the normal appearance:

https://i.sstatic.net/KYzNZ.jpg

.cards {
  margin-top: 100px;
}

.cards h1 {
  text-align: center;
}
/* CSS rules for figures, links, and captions go here */
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="cards">
  <h1>What We Offer</h1>
  <div class="row">
    <div class="col-lg-3 col-md-6">
      <a class="" href="#">
        <figure style='background-image: url("offers/conference.jpg")'>
          <figcaption>
            <h4> <span>Conference halls</span></h4>
            <p></p>
          </figcaption>
        </figure>
      </a>
    </div>
    <div class="col-lg-3 col-md-6">
      <a class="" href="#">
        <figure style='background-image: url("offers/restaurant.jpg")'>
          <figcaption>
            <h4> <span>Restaurant & Bar</span></h4>
            <p></p>
          </figcaption>
        </figure>
      </a>
    </div>
    <div class="col-lg-3 col-md-6">
      <a class="" href="#">
        <figure style='background-image: url(offers/entertainment.jpg)'>
          <figcaption>
            <h4> <span>Entertainment room</span></h4>
            <p></p>
          </figcaption>
        </figure>
      </a>
    </div>
    <div class="col-lg-3 col-md-6">
      <a class="" href="#">
        <figure style='background-image: url("offers/spa.jpg")'>
          <figcaption>
            <h4> <span>Spa & Wellness</span></h4>
            <p></p>
          </figcaption>
        </figure>
      </a>
    </div>

  </div>
</div>

Answer №1

After reviewing your code snippet, I noticed that you have assigned a fixed width value of 265px to the "figure" tag in your CSS. This is causing an overlay on the parent column div. To fix this issue, try updating the width property to either "auto" or "100%". I have provided an updated snippet below for you to implement.

figure {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: 360px;
    margin-left: 25px;
    padding: 20px 20px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 10px;
    box-shadow: 0 14px 28px;
}

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

Ways to employ data binding for extracting a user-input value and performing multiplication operations with the enclosed {{ ...}} tags

My API response includes the price of a product, which is represented as {{price}} I have a system where I can add or reduce the number of products: <div class="number-input"> <h2>Price: {{price }}</h2> <button oncli ...

Using ngModel to achieve two-way binding within nested *ngFor loops in Angular

Here is how my JSON is structured: "assets" : [ { "resourceName" : "keyboard", "characteristics" : { "serialNo" : "abc123", "brand" : "DELL" } }, { ...

What strategies can be employed to preserve certain fields while dynamically populating others using JSON in a form?

Currently, I am utilizing jquery Populate to dynamically fill a field with the information from the previous Firstname and Surname fields within the same form. However, an issue arises when using the Populate javascript function: $(formname).populate(newfi ...

How can I create distinct edges that intersect the surfaces of other objects in THREE.js?

Currently, I'm involved in a three.js project where I need to display all edges of geometries, even when those edges intersect with surfaces of other objects. Below is the code snippet that showcases my dilemma: var camera, scene, renderer, materi ...

Building logic for data manipulation in React Table

Is there a simpler method to showcase data effectively? Here's a sample of my data: const data = [ { business: false, utilization: { ActiveParticipantsPercent: 55.55, SeparatedVestedParticipants: 0, ParticipantsWithBenefitA ...

Markdown in Vue.js filters

I found a helpful example by Evan You on how to convert HTML to markdown - check it out here. However, when trying to install the marked package via npm and implementing it, I encountered an error stating that 'marked' is not defined. After inc ...

Sequelize query for filtering on a many-to-many relationship

Seeking assistance with Sequelize ORM in express.js, I have successfully implemented a many-to-many relationship between two tables. To simplify my query, imagine the tables as Users, Books, and UserBooks where UserBooks contains UserId, BookId, and an ex ...

Injecting resolve into Angular controller and encountering undefined value in logging operation

My setup involves the following: .state('posts', { url: '/posts/{id}', templateUrl: 'posts.html', controller: 'postsController as postsCtrl', resolve: { post: getSinglePostWrapper ...

My Node/Express service seems to be generating a span in the logs, but I am unable to locate my service in the Ja

Currently, I am in the process of setting up Jaeger tracing for my Node.js microservice using Express.js. After adding a basic GET request handler in my Express app and hitting the endpoint via curl, I notice that a span is created in the logs. However, w ...

Do HTML buttons without values get sent in a form submission?

When you have a button with the following code: <button class="button yellow" type="submit" name="button">Log in</button> and you submit it, what exactly gets sent to the server for this specific button that has a name attribute but no value ...

React component causing function to fire twice on click

Summary: My toggle function is triggering twice upon clicking the button. Within a React component (using Next.js), I am utilizing the useEffect hook to target the :root <html> element in order to toggle a class. The script is as follows: useEffect( ...

Tips for manipulating the array within nested objects in React state

I am looking to make changes to the age array const [varient, setVarient] = useState([ { id: 0, targets: { ageGender: { age: [], gender: [] }, parameterData } }, ]); After the update The updated array looks like this: Array = [ { id: 0, targe ...

Styling is not being applied by span tags when inserted using innerHTML

I have a Angular application where I display query results in a div (identified by the ID JSONContainer). To emphasize specific queries within the results, I implemented a pipe that searches for and replaces FIELD:VALUE with: <span class="highlightSpa ...

What are the steps to view output on VS Code using Typescript?

Currently, I am working on code challenges using Typescript in Visual Studio Code. However, whenever I attempt to run the code and view the output, I encounter an error stating "Code Language is not supported or defined". I have already set the language ...

Transfer information between two clients using AJAX on the same localhost

I'm looking to create a connect four game with the capability of playing online against another player connected to my localhost (within the same WiFi network). While it's possible to play the game on two separate computers, they currently can&ap ...

I'm having trouble with my AngularJS Spinner directive

Check out this simple directive I created to display a spinner on my button while something is happening remotely: http://plnkr.co/edit/rAJ4X7A3iidmqUD2M63A?p=preview Here's the html: <!DOCTYPE html> <html ng-app="app"> <head> ...

Utilize elements within a for loop to iteratively access distinct anchors

Currently, I am working on integrating a blog feature into my Vue project. <li v-for='blog in blogs' :key="blog.id"> <a>{{ blog.name }}</a> </li> I'm looking for a way to add a unique anchor link (to e ...

How to send a contact form in Wordpress with multiple attachments via email without using any plugins

The main objective is to enable users to submit their own content for new articles (including text and files) to the administrator's email. A form has been created for this purpose: <form class="form form-send" enctype="multipart/fo ...

The height set to 100% is causing issues with the padding-bottom property

Currently, I have a setup that includes: A div with width set to 100% and height set to 100% An SVG element inside the div with default width and height of 100% My issue is that when applying padding to the div, the left, right, and top padding seem to w ...

Pagination displays identical data on each page

When utilizing pagination in my AngularJS application to display search results fetched from an API call, I encountered an issue where the same data set appears on all pages. Here's what I have attempted: Within the Controller $rootScope.currentPag ...