Bootstrap image badges

I am seeking help to place badges on an image, similar to the example picture below. My knowledge of CSS is limited, so any assistance would be greatly appreciated.

.product {
  margin: 0 30px 30px 0;
  width: 360px;
  position: relative;
  float: left;
}
.image-product {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  border: solid;
  border-width: 1px;
}
.image-product > a,
.image-product img {
  display: block;
  width: 100%;
  height: 100%;
}
<div class="product clearfix">
  <div class="image-product">
    <a href="#">
      <img src="http://richthediabetic.com/wp-content/uploads/2013/07/Pizza.jpg" />
    </a>
  </div>
</div>

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

Answer №1

Include an img tag with a badge placed on top of the image

<div class="product clearfix">    
    <div class="image-product">
        <a href="#">
            <img class="badgeOne" src="http://richthediabetic.com/wp-content/uploads/2013/07/Pizza.jpg" />
            <img src="http://richthediabetic.com/wp-content/uploads/2013/07/Pizza.jpg" />
        </a>
    </div>
</div>

Be sure to add the badgeOne class to your CSS like this

.product {
  margin: 0 30px 30px 0;
  width: 360px;
  position: relative;
  float: left;
}
.image-product {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  border: solid;
  border-width: 1px;
}
.image-product > a,
.image-product img {
  display: block;
  width: 100%;
  height: 100%;
}

.badgeOne {position: absolute;
    top: 10px;
    right: 10px;
    width: 20px !important;
    height: 20px !important;
    border: 1px solid;}

Feel free to customize it as needed...

Check out a sample Fiddle

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

Creating a dropdown menu with an initial value fetched from a text file

I'm currently working on a school project that involves adjusting basic wireless parameters in a Linux router using command-line operations through an HTML interface. My experience has mostly been with PHP, and so far, I've been progressing well. ...

What is the reason for the index.html file not connecting to the local .css files and .js file?

I'm currently using node.js to send an .html file that includes the following tags: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="description" content="This is my personal profile website" /> <link r ...

datetime-local format changing after selection

In an ionic application running on an android system, there is a issue with the formatting of <input type='datetime-local'> inputs. After a user selects a date, the Start input is formatted differently than the Ende input. Attempts to use t ...

problems arise due to padding and floating on the navigation bar

I have been facing a couple of challenges with my code. Firstly, I am trying to remove the small annoying line underneath my selected navigation links and also attempting to float both the header and footer to the right without losing their backgrounds. I ...

The browser freezes after a short delay following an Ajax request

I recently created an admin panel with notification alerts using Ajax. Initially, everything was working smoothly, but after a few minutes, the browser started freezing. I'm new to Ajax development, so I'm unsure what could be causing this issue. ...

How can I display random images in the gallery?

I am looking for a gallery that is similar to the one in this provided link: The codes seem too complex for me to figure out on my own. Thank you ...

Preventing the display of AngularJS HTML tags while the app is being loaded

I am new to AngularJS (using version 1.5.8) and I am currently following the tutorials provided on docs.angularjs.org/tutorial. Below is the HTML code snippet: <div class="jumbotron"> <h1>{{application_name | uppercase }}</h1> ...

jQuery Slider Showing Incorrect Images

My jQuery slider is acting strangely. It hides the first image, shows the second one, but then just repeats the cycle by showing the first image again instead of loading the third one. I'm puzzled about what could be causing this issue in my code. Do ...

Two divs with floated attributes and equal heights

My unique HTML is below: <div class="container"> <div class="box"> <div class="float"> <img src='http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/db/miami-beach.jpg' /> </div> ...

Tips for organizing the outcome of a seamless web scraping operation with Apify and Puppeteer

Extracting data from a table on the designated URL using Apify and Puppeteer is my current goal: https://en.wikipedia.org/wiki/List_of_hedge_funds The desired outcome should be an array of objects. Each element in the array must represent a <tr> ro ...

Hide the div when hovering occurs

I need a way to hide the 'sample' div when hovering over it and then show it again when the mouse moves away $('.secmenu').hover(function() { $('.sample').css('opacity', '0'); if ($('.secmenu&a ...

The Bootstrap glyphicon content breaks when using ASP.NET MVC minification

When working with asp.net, I noticed that minification tends to disrupt the display of bootstrap UTF symbols. For example, here is what it looks like in the original file: .glyphicon-edit:before { content: "\e065"; } And here is how it appears in ...

Is it possible to align text to an image within an input text field?

<input type="text" class="usernm" style="color:black;font-weight: bold;outline-width: 0;" id="username" /> I have a question about styling HTML. I am attempting to include an icon inside a text field, but I'm strugglin ...

Adjust the image size without losing sharpness

I'm currently working on a web application for Minecraft and I am looking for a way to resize someone's skin without losing quality. I believe javascript might be the solution to this issue. ...

Issue with Bootstrap v3.3.7 panel not collapsing as expected following height adjustment

Utilizing bootstrap 3.3.7 panels, I encountered an issue when trying to slide up the panel using the icon. The panel would not hide properly once the panel height was set, resulting in only the panel content body sliding up. Here is an example: $(&apo ...

Is it possible to adjust the CSS code linked to the HTML tag based on the specific webpage being viewed?

I am facing an issue with the homepage of my website, which uses Scrollmagic.js for smooth scrolling. In order for the sticky footer CSS to work properly on all other pages, the HTML tag needs to have a height of 100%. However, if I add this height value t ...

Tips for sending information to select2 version greater than 4.0

I'm exploring the use of select2 for the first time and wondering if someone could assist me. I want to pull data from a static array. Can you offer any guidance on how to achieve this? This is the code I currently have: $(document).ready(function( ...

Enable multi-vertical filtering in Kendogrid

https://i.sstatic.net/FfAhT.jpg Currently utilizing a jQuery kendogrid Attempting to modify the filter popup to display vertically instead of horizontally. In need of assistance with the styling necessary to achieve a vertical orientation instead. ...

Guide on dynamically displaying a keyboard in an Android mobile application when an input field is present, utilizing jQuery

When accessing the input field in my application on Android mobile devices, I need the keyboard to appear dynamically. I attempted to achieve this using jQuery by using the code $('#appear').focus(); Although the focus is being set on the input ...

Prevent horizontal HTML scrolling while displaying a layer

I am currently working with a .layer div element that darkens the page to highlight a modal. However, I have encountered an issue where upon triggering the event, the div does not occupy 100% of the screen and the original browser scroll bar disappears. I ...