Ways to add margin-top to a card element without affecting the entire container-fluid

I'm attempting to change the background image of this container, but when I add margin-top to the card element, it shifts everything over the picture. Below is my Bootstrap4 code:

#card.container-fluid {
  background-image: url("../images/picture2.jpg");
  background-position: 12em;
  background-size: cover;
  margin-bottom: 20px;
}
<div class="jumbotron jumbotron-billboard">
  <div class="img"></div>
  <div class="container">
    <div class="row">
      <div class="col-lg-12">
        <h1>title</h1>
        <div>
          <a>link</a>
          <a>lnk</a>
          <a>link</a>
          <a>link</a>
          <a>link</a>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="container-fluid" id="card">
  <div class="card" style="width: 50%">
    <div class="card-body" id="bod">
      <h4 class="card-title">title</h4>
      <p class="card-text" style="text-align: justify;">
        text text tex
      </p>
    </div>
    <img class="card-img-bottom" src="image1.jpg" alt="Card image" style="width:100%">
  </div>
</div>

I've experimented with adding margin-top to .card and #bod.card, but it keeps affecting the position of the image too. Any assistance would be greatly appreciated!

Answer №1

If you need more options, consider utilizing padding as a solution.

#card.container-fluid {padding-top: 20px;}

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 jQuery to dynamically add li elements with AJAX and using the Append and Prepend methods

Having a little trouble here. Here is the HTML snippet: <ul class="buildings-list"> <li class="gchoice_20_0"> <input name="input_20" type="radio" value="House" checked="checked" /> <label for="choice_20_0" id="label_ ...

SVG path with dynamic elements

Consider the following SVG: <svg xmlns="http://www.w3.org/2000/svg" width="237" height="129" viewBox="0 0 237 129" fill="none"> <path d="M228 1H9C4.58172 1 1 4.58172 1 9V91V104V127L20 111.483L228 112C232.4 ...

The element in the data cell is a form input field

This is the content of my webpage: <input type="text" class="form-control" >id="ButonSociete"name="ButonSociete"placeholder="Societe"> <table cellpadding="0" cellspacing="0" border="0" class="display" >id="demande" width="100%"> ...

Customizing the Dropdown Arrow Icon to a Desired Icon of Choice

I'm looking to customize the dropdown select on my website by changing the arrow icon to a plus icon, which will then turn into a minus icon when clicked and the choices are displayed. I'm new to jquery and eager to learn more about this language ...

What is the method for modifying the appearance of the background property on an input element?

I am currently working on customizing an HTML5 video player's track bar using CSS. My goal is to utilize jQuery to modify the style of the track bar. One way I have attempted to change the background of the track bar with jQuery is by employing the f ...

Browser now replacing attribute translate="yes" with translate="translate"

We have encountered an issue with a translation library that is affecting the functionality of our page. <html lang="en" class="notranslate translated-ltr"> <meta name="google" content="notranslate"> As ...

Issues with Safari text shadow not rendering properly when extending beyond the element border

I've encountered a situation where I have a text shadow applied with the following CSS: body { background: white; } h1 { color: black; text-shadow: 100px 100px 10px black; } https://i.sstatic.net/j8OTS.png When viewing in Safari browser, t ...

Adjust and position any svg element to fit the entire viewport

Forgive me for being just another person to ask this question. Despite my efforts, I have yet to find a solution. I am trying to resize "any" svg to fit the entire viewport, centered. Take for example this svg element: <svg baseProfile="full& ...

Transmit a combination of selection and text inputs through AJAX to PHP, and then save the data in a

Is it possible to send multiple inputs (one text and one select multiple) via AJAX to a PHP file? The data is successfully sent using form serialize, as evidenced by the complete array in prod_multi when logging with console.log. However, I am facing an is ...

Achieving successful content loading through AJAX using the .load function

Our website features a layout where product listings are displayed on the left side, with the selected product appearing on the right side (all on the same page). Initially, when the page loads, the first product is shown on the right. Upon clicking a new ...

Updating the value of a localStorage key after each successful AJAX call in JavaScript

I'm currently facing a challenge with my local storage key value. The issue is that it doesn't update the value when the AJAX call successfully returns data. It only retains the old stored data, requiring me to manually refresh the page by pressi ...

An image spanning two columns on a page with three columns

I am currently utilizing Foundation 4 for my website design. I am attempting to create an image that spans over 2 columns in a 3-column layout using the Foundation grid system. Here is how I envision it: https://i.sstatic.net/m7InR.jpg I am wondering if ...

Avoiding the repetition of CSS animations during Gatsby page hydration

I am facing an issue in Gatsby where I have an element with an initial CSS animation. It works perfectly when the static site loads, but after hydration, it keeps repeating. Is there a way to prevent this from happening? Below is my styled components code ...

Using HTML Select field to make ajax calls to web services

When working with modals that contain forms to create objects for database storage, there is a Select field included. This is the code snippet for the Select field: <div class="form-group" id=existingUser> <label>Username</label> < ...

What is the best way to align a single item to the right on the navbar in Bootstrap 5.3 (v5.3.0-alpha1)?

Attempting to position a dropdown link to the right in my Bootstrap 5.3 navbar proved to be challenging. The method that worked with Bootstrap 3, using navbar-right, and with Bootstrap 4, possibly ml-auto, did not work with Bootstrap 5 beta which uses me-a ...

What method can I use to replace the status bar from the top?

Is there a way to smoothly slide in and out a <View/> on React Native iOS, similar to the animation sequences shown in the images below? ...

How can you place text on top of an image using JQuery and CSS?

I've been working on overlaying text over an image using Jquery and css. The overlay text is displaying nicely on the image, but I'm struggling to change the font and size of the text. I attempted to make changes in the CSS for the font family an ...

My sub menu bar is not working properly, I need to fix it so that it can dropdown correctly

I'm struggling with my sub menu layout and need some assistance in fixing it. I've tried numerous times to adjust it using CSS, but without success. Here is the link to my menu. I'm still learning CSS and could really use some guidance: # ...

Struggling to locate the distinctive XPath for the button

I am facing a situation where the XPath is non-unique and identifies 3 elements on the page that change positions upon refresh: <div class="col-xs-12 Hover"> <button data-testid="continueCheckoutButton" ng- class="continueDellMetricsC ...

Row in Bootstrap 3 fails to display correctly on medium-sized devices

Having trouble with divs of different sizes? I want a row that shows 3-column wide divs on medium & large screens and 6-column wide divs on small devices. <div class="container"> <div class="row"> <div class="service col-sm-6 col-md-3"& ...