How to easily incorporate images after text in Bootstrap 4 beta

I seem to be having trouble inserting an image in the "menu" section for the last item "Kava so sebou" after the text. I want the picture to be centered vertically and the row to maintain consistency with the other items above it. Any advice or suggestions would be greatly appreciated! By the way, I'm new to learning bootstrap and happen to be a girl - quite an interesting combination!

Custom CSS

.menu {
  padding: 70px 0;
}
.menu .block > p {
  color: #9D9D9D;
  font-size: 16px;
  line-height: 26px;
  padding: 40px 133px 0;
  text-align: center;
}
.menu .block .pricing-list {
  padding-top: 5px;
}
.menu .block .pricing-list ul {
  list-style-type: none;
  padding: 0 0 30px;
  margin: 0;
}
.menu .block .pricing-list ul li {
  padding: 21px 0;
}
.menu .block .pricing-list ul li .item .item-title {
  position: relative;
}
.menu .block .pricing-list ul li .item .item-title h2 {
  display: inline-block;
  position: relative;
  z-index: 99;
  background: #fff;
}
.menu .block .pricing-list ul li .item .item-title .border-bottom {
  position: absolute;
  top: 0;
  width: 100%;
  height: 1px;
  border: 1px dotted #C9C9C9;
  margin-top: 40px;
}
.menu .block .pricing-list ul li .item .item-title .border-bottom-coffee {
  position: absolute;
  top: 50px;
  width: 100%;
  height: 1px;
  border: 1px dotted #C9C9C9;
  margin-top: 30px;
}
.menu .block .pricing-list ul li .item .item-title span {
  float: right;
  color: #938463;
}
.menu .block .pricing-list ul li .item .item-title img {
padding-bottom: 20px;
}
.menu .block .pricing-list ul li .item p {
  padding: 12px 0;
  color: #949494;
}
 <!-- Start Menu list -->
    <section id="menu" class="menu">
     <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="block">
                        <div class="pricing-list">
                            <div class="title">
                             <div class="container">
                             <ul>
                                <li class="wow fadeInUp" data-wow-duration="300ms" data-wow-delay="1100ms" style="visibility: visible; animation-duration: 300ms; animation-delay: 1100ms; animation-name: fadeInUp;">
                                    <div class="item">
                                        <div class="item-title">
                                            <h2>Pivo 10 0.5L</h2>
                                            <div class="border-bottom"></div>
                                            <span>€ 1.20</span>
                                        </div>
                                        <p>Zlatý Bažant, Staropramen</p>
                                    </div>
                                </li>
                                <li class="wow fadeInUp" data-wow-duration="300ms" data-wow-delay="1200ms" style="visibility: visible; animation-duration: 300ms; animation-delay: 1200ms; animation-name: fadeInUp;">
                                    <div class="item">
                                        <div class="item-title">
                                            <h2>Káva so sebou </h2>
                                            <div class="border-bottom"></div>
                                            <span>€ 1.20</span>
                                        </div>
                                        <p>Štrbské Presso</p>
                                    </div>
                                </li>
                            </ul>                          
                        </div>
                    </div><!-- block close -->
                </div><!-.col-md-12 close-->
            </div><!-.row close-->
        </div><!-.container close-->
    </section><!-.price close-->

Answer №1

If you're looking to enhance your design skills, I recommend checking out this section of the bootstrap documentation: http://getbootstrap.com/docs/4.0/layout/media-object/

For your current task, consider assigning the container div class as media, enclosing your text in a div with class media-body, and attaching media-object to the div containing your image.

After making these adjustments, a few tweaks in your css should result in a polished appearance.

Feel free to explore this quick code snippet I've put together:

<div class="item">
        <div class="item-title media">
                <div class="media-body" style="white-space: nowrap;padding-top: 50px;">
                       <h2>Coffee To Go</h2>
                </div>
                <div class="media-object">
                       <img class="align-self-center mx-auto d-inline-block text-nowrap" src="./images/coffee.jpg">
                </div>
                <div class="border-bottom-coffee" style="position:relative;"></div>
                <span>€ 1.20</span>
        </div>
</div>

Answer №2

Thank you for your guidance. I found success with this method.

<li class="wow fadeInUp" data-wow-duration="300ms" data-wow-delay="1200ms" style="visibility: visible; animation-duration: 300ms; animation-delay: 1200ms; animation-name: fadeInUp;">
  <div class="item">
    <div class="item-title media">
      <h2>
        Coffee to go
        <p>Štrbské Presso</p>
      </h2>
      <div class="border-bottom"></div>
        <div class="media-object">
          <img class="d-block img-fluid" src="./images/coffee.jpg">                                               
        </div>
        <div class="media-body">
        <span>€ 1.20</span>
      </div>
      </div>
    </div>
</li>

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

Unable to apply 100% height to flex child element

When it comes to creating a layout for my website, I have a simple idea in mind. I want the body content to take up at least 100% of the height of the page. This setup works perfectly on desktop screens, but when I switch to a mobile view (which changes th ...

How to Stop Browser Tooltip from Displaying HTML Tags within "innerHtml" in Angular 6

In my Angular application, a template is using the following code snippet: ... <span [innerHtml]="textVar"></span> ... The textVar variable is created to allow for special styling on certain characters or strings. It's formatted using th ...

What is the most effective method for incorporating parameterized aesthetics using CSS in a JSP program?

I am currently working on a JSP web application without the support of any framework, unfortunately. This application is intended to serve multiple customers, each with their unique set of colors and company logos. The overall layout of the CSS will remai ...

Emphasize any word starting with an @ symbol to highlight its importance

My goal is to enhance the appearance of words that begin with an "@" symbol by making them bold. For example, transforming the sentence: '@xyzharris has a cat @zynPeter' into: '@xyzHarris has a cat @zynPeter' ...

Arranging Bootstrap dropdown and buttons on a single line

Check out my code snippet here: http://jsfiddle.net/52VtD/7462/ I'm facing an issue where I want to align my dropdown and buttons on the same line, but the dropdown being a div, it stays on the line below. How can I ensure they are on the same line? ...

Unable to modify $scope value within the directive

This special function triggers once ng-repeat is done iterating through the list using scope.$last: simpleSearchApp.directive('afterResults', function($document) { return function(scope, element, attrs) { if (scope.$last){ scope.windowHe ...

Personalizing a class specifically for error messages within the jQuery Validation plugin

When using the jQuery Validate plugin, is it possible to set a separate class for the error message element without affecting the input element's class? ...

Removing jQuery error label from an HTML block

I need a single command that will remove an error label from my HTML when the field content is changed. It currently works on input and select elements, but not within an input-group. I am looking for a solution that will work universally across all instan ...

JavaScript Cookie Array Handling

Is it possible to create a 2D array as a cookie in JavaScript? If so, how can I go about creating this array cookie and looping through it to retrieve data efficiently? Any guidance on this would be greatly appreciated. Thank you! ...

Converting Mat-Raised-Button into an HTML link for PDF in Angular 6 using Material Design Library

Greetings, I have a couple of interrelated inquiries: Upon clicking the code snippet below, why does <a mat-raised-button href="../pdfs/test.pdf"></a> change the URL (refer to image 4) instead of opening test.pdf in a new window? If I have a ...

Focusing solely on a particular category in EJS

I am struggling with this code snippet. HTML: <header<% if ( current.source === 'features' || current.path[0] === 'index' || current.source !== 'customers' ) { %> class="header-white"<% } %>> <div cl ...

Simple steps to generate a static header in list view on asp.net

I'm struggling to keep my header fixed while scrolling and can't seem to figure it out. Below is my ListView Code: <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="FormSectionSubSectionItemRelID" OnSele ...

Leveraging Vue Data for Storing CSS Properties

I am currently utilizing the Quasar framework in conjunction with Vue for my application development. Below is a snippet of my code: <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"> Save </q-tooltip> <q-tooltip c ...

Is there a way to incorporate an 'ended' feature into the .animate() function?

I'm currently working on a jQuery statement where I want to activate pointer events once the button animation is finished. However, I'm unsure how to incorporate an ended or complete function. Any suggestions on how to approach this? $('#ce ...

Importing an Excel file in .xlsx format cannot be done through AJAX JQUERY

I am trying to display the content of an Excel file when a button is clicked. It works fine when I change the extension to .csv, but when I change it to .xlsx, I get a character type error that looks like "y!+EfMykK5=|t G)s墙UtB)". These strange charact ...

Tips on using Ajax to post in HTML

Here is the code I have been working on: <script type="text/javascript"> var xmlDoc; var xmlhttp; function loadRates() { xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = readRates; xmlhttp.open("GE ...

Utilizing AJAX and PHP for dynamic changes based on listbox selection

Is there a way to make the query run whenever a selection is made from the listbox? if(isset($_POST['select'])){ $newselection=$_POST['select']; $query = "SELECT count(*) FROM listings where description=" . $newselection. ""; $r ...

Replace particular letters within the text with designated spans

Suppose I have this specific HTML code snippet: <div class="answers"> He<b>y</b> <span class='doesntmatter'>eve</span>ryone </div> Additionally, imagine I possess the subsequent array: ['correct' ...

css - Showcasing images with a horizontal scrollbar

I'm having an issue with displaying multiple images in a fixed-width div horizontally. I want to have a horizontal scroll bar for the images that exceed the width of the div. Currently, the images are appearing vertically instead of side-by-side. Is ...

How can I confirm that all elements have been properly reset to their original positions prior to making any further adjustments to them?

In need of some creative brainstorming, I'm working on a website design featuring ten overlapping cards. When the mouse hovers over a card, it expands while others move away. My goal is for each card to return to its original position once the cursor ...