Creating a sleek border around your list items to resemble a stylish price tag

Is it possible to create custom borders around list items with a unique border on the left side of each item?

For example, see this image:

I have tried using CSS 3 angles but I can't seem to achieve an inner circle or hole effect with borders. It appears to be more complicated and time-consuming than using images.

Currently, I am exploring the option of using background images. I have disabled the left border and am attempting to position a graphic along the left edge of each item, however, I haven't had any success yet. The items vary in length and are floated left within a horizontal slider, adding complexity to the situation.

In addition, I need different hover and active styles as indicated in the image.

Finally, I would like to include a round styled circle or ellipse that can display a number indicating the quantity of items in the category, positioned at the upper right corner of the styled list item box.

This is where I currently stand with my progress:

HTML:

<div class="filters">
                <div class="filters-inner">
                      <ul id="filters-slider" class="filters-list">
                    <li><a href="#">Darling</a></li>
                    ... (additional list items here)
                </ul>
          </div>
</div>

CSS:

.filters {
background-color: #fff;
padding-top: 3px;
... (CSS rules continue)
}

.div.sample {
padding-top: 200px;
}

If anyone has insight on how to achieve this design effectively, please share your knowledge!

Answer №1

Introducing a unique solution utilizing a background image sprite, I have implemented the use of the <a> tag for the entire "price tag" shape to enhance user interaction. The hover/active state is achieved through a background sprite, while the "quantity" number is enclosed in a span tag.

For an example of this solution in action, refer to: http://jsfiddle.net/alexroper/zhrwA/34/

Here is the structure of the HTML code for the "price tag" list:

<ul id="filters-slider" class="filters-list">
  <li><a href="#">Darling</a> <span class="tag-qty">103</span></li>
  <li class="active"><a href="#">Online Audience</a> <span class="tag-qty">9</span</li>
  <li><a href="#">Digital Strategy</a> <span class="tag-qty">20</span></li>
</ul>

The following styles are used to construct the "price tags":

ul.filters-list {
  text-align: center;
  white-space: nowrap;
  display: inline-block;
  padding-top: 10px;
}
ul.filters-list > li {
  color: #666666;
  font-weight: bold;
  float: left;
  list-style-type: none;
  line-height: 26px;
  margin-right: 10px;
  margin-left: 10px;
  position: relative;
}
ul.filters-list > li > a {
  color: #666666;
  padding: 0 18px 0 24px;
  background: url('https://www.dropbox.com/s/n8e74eikwf82vks/tag_sprite.png?raw=1') 0 0 no-repeat;
  border-right: 1px solid #ccc;
  display: block;
}
ul.filters-list > li > a:hover,
ul.filters-list > li.active > a {
  text-decoration:none;
  background-position: 0 -30px;
}

To depict the "quantity" numbers, the following styles are applied:

.filters-list .tag-qty {
  position: absolute;
  top: -8px;
  right: -9px;
  border: 1px solid #bbb;
  line-height: 16px;
  display: inline-block;
  padding: 0 5px;
  background: #fff;
  -webkit-border-radius: 9px;
          border-radius: 9px;
     -moz-background-clip: padding; 
  -webkit-background-clip: padding-box; 
          background-clip: padding-box;
  -webkit-box-shadow: 0px 0px 3px 0px #ccc;
          box-shadow: 0px 0px 3px 0px #ccc;
}
.filters-list .active .tag-qty {
  background:#ebebeb;
}

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

Issues loading SVG pattern textures with PHP

While experimenting with SVG and PHP codes, I encountered a frustrating issue that has me stumped. I have an SVG image containing some shapes. Using the fill attribute and the def tag, I can easily apply textures to specific shapes using a simple GET var ...

Is it possible to showcase a FullCalendar event in full width while being positioned behind other events scheduled for the same time slot?

Is there a way to customize FullCalendar so that concurrent events in the same timeslot are not vertically divided? I have a Google calendar named "time-blocking template" where I want all events to take up 100% of the timeslot width, even if there are ot ...

What is the best way to include default text in my HTML input text field?

Is it possible to include uneditable default text within an HTML input field? https://i.stack.imgur.com/eklro.png Below is the current snippet of my HTML code: <input type="text" class="form-control input-sm" name="guardian_officeno" placeholder="Off ...

After applying sorting, jqGrid displays an empty space below the final row

Having an unusual problem with sorting in the jqGrid. When I sort in descending order, there is extra space below the last row, but when I sort in ascending order, the table ends abruptly at the bottom without allowing any further scrolling. I have includ ...

Error: The reference to WEBGL has not been properly defined

Within my HTML, the code snippet below is causing an issue: if (WEBGL.isWebGLAvailable()==false) { document.body.appendChild(WEBGL.getWebGLErrorMessage()); } Upon running this code, the following error appears in the console: Uncaught ReferenceErr ...

Tips for transferring simple CSS formatting to an independent stylesheet

As part of a university project, I am working on a basic website. Initially, I used in-line styling for the website design. However, the subject coordinator has now changed the requirements and we are only allowed to use an external CSS stylesheet. Most of ...

Error: Trying to access the 'name' value of an undefined variable causes uncaught type error

Having a global JSON object, encountering an error when trying to parse its value in a loop. The error message displayed is "uncaught type error : Cannot read value 'name' of undefined". Despite multiple attempts, a solution remains elusive. ...

What is the reason behind every element in bootstrap being enclosed within an anchor tag?

I am currently delving into the world of bootstrap for the first time and encountering an issue with the grid system. Somehow, whenever I try to incorporate an - a href="#" - tag within the grid, it distorts the layout inexplicably. I have been struggling ...

Is there a way to position the primefaces DefaultMenuModel in front of an accordion panel?

Currently, I have a DefaultMenuModel nested within a tab in an accordion panel. However, the menu is appearing behind the tab of the accordion panel and I want to adjust the z-index of the menu so that it appears in front of the tab. Here is the current ...

Utilizing the Card-columns feature in Bootstrap

One issue I am currently facing is the way my generated cards appear in the card-columns div: while($row = $categorias->fetch_assoc()) { $imagen = $row["Imagen"]; $categoria = $row["Categoria"]; echo "<div class='card'>"; echo " ...

Loading content beforehand vs. loading it on the fly

I am facing a dilemma with loading a large amount of content within a hidden <div>. This content will only be revealed to the user upon clicking a button. Should I load this content beforehand or wait until it is requested? ...

steps for marking comments as read or unread by multiple users

I'm working on a development blog for my project and I'd like to add a feature where users can mark comments as unread until they view them. For example, if an admin posts a comment, all users in that project should see it as unread. Can anyone ...

The concept of nested labels: defining conditions for displaying specific sections of a label

Let's say I have a label that contains the following text: <label>This is a text. This is another text.</label> Is there a way to indicate that the second sentence should only be visible when a boolean value is true? For example: <la ...

Troubleshooting: Unable to preview Facebook Page plugin

When I visit the Facebook developer site to get the code for a Facebook page plugin, I use this link. The preview feature works perfectly with pages like "facebook.com/Nike", but when I try it with my own page, "facebook.com/BargainHideout", it doesn&apos ...

Rearranging anchor tag order with the power of JQuery

Imagine I have five anchor tags <a id = "A" class = "Home">Home</a> <a id = "B" class = "Maps">Maps</a> <a id = "C" class = "Plans">Plans</a> <a id = "D" class = "Community">Community</a> <a id = "E" clas ...

Several radio buttons and their corresponding labels are shown on a single line inside a nested div container

Upon stumbling across this post, I realized it perfectly aligns with my current goal: Radio Button and Label to display in same line. However, the challenge persists... The layout I currently have (first 3 columns) differs from what I aspire to achieve (l ...

The command `python3 manage.py findstatic` is unable to locate the static file

I have been struggling to incorporate static files into my project, but the CSS is not loading. I tried using findstatic but Django is unable to locate any static directory: https://i.sstatic.net/jRgzx.png https://i.sstatic.net/7VG0x.png In a different pr ...

The view has no access to $scope but the controller does

I need to display the iso code using a $scope when selecting a country from a list. The list of countries is fetched through a $http call in a factory and then stored in a scope. ///////// get countries //////////////// tableFactory.getCountries().then(f ...

What is the function of table widths in accommodating wider details during insertion?

What happens when a detail width is set to <td width="10"...> and something wider, like a picture that is 20 pixels wide, is placed in that detail? ...

Tabbable bootstrap with dropdown functionality

I am currently in the process of integrating Bootstrap tabs and dropdown menus using version 2.3.4 <div class="container"> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container-fluid"> ...