# جعل العلامات تبدو مثل العلامات في العالم الحقيقي

**URL:** https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237
**Category:** UX
**Created:** [23 أكتوبر 2018، 7:40ص UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237 "2018-10-23T07:40:38Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![rootsh3ll](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rootsh3ll/32/119507_2.png) [@rootsh3ll](https://meta.discourse.org/u/rootsh3ll)
#### Post date: [23 أكتوبر 2018، 7:40ص UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/1 "2018-10-23T07:40:38Z")

</div>

I was looking for having CSS for tags like this: ![18%20PM](https://global.discourse-cdn.com/meta/original/3X/7/a/7a15a98b9a1a29027c3d2485b8ad4e6c15348476.png)

But my current tags look like this:

 ![46%20PM](https://global.discourse-cdn.com/meta/original/3X/e/2/e2613559b238a95a1d1c6a40869e7fa0963ce556.png)

See `txpower` and `alfa` are tags.

Here’s the CSS I am using:

```plaintext
.discourse-tag.box {
    border: 1px solid #595959;
    border-radius: 3px;
    background-color: transparent;
    padding: 1px 6px;
    font-weight: bold;
}

```

For the sake of differentiability, I wanted my tags to look like real tags, but CSS from the internet is breaking the discourse’s CSS in unimaginable ways. and I just can’t get it right. Can anyone help with the CSS changes I need?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [23 أكتوبر 2018، 12:25م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/2 "2018-10-23T12:25:13Z")

</div>

I was looking to use something similar years ago, you can try to use this and customize it as you wish

```
.discourse-tag.box {
  position: relative;
  display: inline-block;
  text-decoration: none;
  background-color: #bfbfbf !important;
  height: 26px;
  line-height: 26px;
  padding: 0 20px 0 23px;
  margin: 0 10px 0 0;
}
.discourse-tag.box::before {
  position: absolute;
  content: '';
  background: #fff;
  border-radius: 100%;
  height: 6px;
  left: 10px;
  width: 6px;
  top: 10px;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.25);
}
.discourse-tags .discourse-tag.box::after {
  position: absolute;
  content: '';
  background: #fff;
  border-bottom: 13px solid transparent;
  border-left: 10px solid #bfbfbf;
  border-top: 14px solid transparent;
  right: 0;
  top: 0;
}
a.discourse-tag.box {
    color: #fff !important;
}

```

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/c/5c3dbbabe841237b6faf7b88fa83ed90cb509dfe.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/c/ec1a0810028b9dda4f1b120fa9e357285b2e4eac.png)

Almost certainly if you have plugins that add elements to the title, as the voting plugin you will need to make corrections.

---

<div class="post-metadata">

### Author: ![rootsh3ll](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rootsh3ll/32/119507_2.png) [@rootsh3ll](https://meta.discourse.org/u/rootsh3ll)
#### Post date: [23 أكتوبر 2018، 3:13م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/3 "2018-10-23T15:13:31Z")

</div>

Awesome! I made some edits like colours and width equal to category and here is my CSS for that:

```plaintext
.discourse-tag.box {
    position: relative;
    display: inline-block;
    text-decoration: none;
    background-color: #646464 !important;
    border-radius: 3px 0 0 3px;
    height: 21px;
    line-height: 21px;
    padding: 0 13px 0 22px;
    margin: 0 10px 0 0;
}
.discourse-tag.box::before {
    position: absolute;
    content: '';
    background: #000;
    border-radius: 100%;
    height: 6px;
    left: 8px;
    width: 6px;
    top: 8px;
    box-shadow: inset 0 1px rgba(0,0,0,0.25);
}
.discourse-tags .discourse-tag.box::after {
  position: absolute;
  content: '';
  background: black;
  border-bottom: 11px solid transparent;
  border-left: 10px solid #646464;
  border-top: 10px solid transparent;
  right: 0;
  top: 0;

}
a.discourse-tag.box {
    color: #d4d4d4 !important;
}

```

Note that I disabled my earlier CSS Completely as it was conflicting with the newer one. and made it honor the black theme 🙂

> [@rootsh3ll](#):
>
> .discourse-tag.box { border: 1px solid #595959; border-radius: 3px; background-color: transparent; padding: 1px 6px; font-weight: bold; }

Here is what it looks like:

 ![53%20PM](https://global.discourse-cdn.com/meta/original/3X/1/5/15b73b43c215bdd9a5dfb9456bf7a4465ca6c023.png)

Although I did want to have the triangle on the left hand side which is more _real-like_ and gives a sense of real tag. which is tied from the triangular end and flat on the other end. But nevermind. I’ll learn some CSS and would post update to it.

Thanks a lot for your code @dax! You are awesome! 😄

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [23 أكتوبر 2018، 5:36م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/4 "2018-10-23T17:36:03Z")

</div>

Nice CSS code snippet 🙂 Thanks!

I experienced a minor issue with my css code: Not sure why, but with Safari and Chrome (!) …

- … on my iPhone 8+, all of the tags have a thin line on the right next to the flap.
- .. on my iPad mini 4, only some thin lines will appear on the right next to the flap. (e.g. tags with 2 characters)
- … on my Mac everything is just fine

It seems, the “after” css container is repeating itself. How can I fix this?

I made them a litte bit thinner … ![03](https://global.discourse-cdn.com/meta/original/3X/2/5/2554b0643271d1a6e1b369731f22c9b17ff454d4.png)

> **See CSS Code**
>
> ```
> .discourse-tag.box {
> position: relative;
> display: inline-block;
> text-decoration: none;
> font-weight: normal;
> background-color: #e28a54 !important;
> border-radius: 3px 0 0 3px;
> height: 20px;
> line-height: 20px;
> padding: 0 13px 0 21px;
> margin: 0 10px 0 0;
> }
> .discourse-tag.box::before {
> position: absolute;
> content: '';
> background: #ffffff;
> border-radius: 100%;
> height: 6px; 
> left: 7px;
> width: 6px;
> top: 7px;
> box-shadow: inset 0 1px rgba(0,0,0,0.25);
> }
> .discourse-tags .discourse-tag.box::after {
> position: absolute;
> content: '';
> background: white;
> border-bottom: 11px solid transparent;
> border-left: 10px solid #e28a54;
> border-top: 10px solid transparent;
> right: 0;
> top: 0;
> 
> }
> a.discourse-tag.box {
> color: #fff !important;
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [23 أكتوبر 2018، 7:06م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/5 "2018-10-23T19:06:28Z")

</div>

Just delete the line `border-radius: 3px 0 0 3px;`  
This fix the thin line problem on IOS (and Chrome) for short tags (thanks to @simon that help me to debug with his Mac).

I will update the code above

PS. I have no Iphone, so check if the fix works even there

---

<div class="post-metadata">

### Author: ![rootsh3ll](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rootsh3ll/32/119507_2.png) [@rootsh3ll](https://meta.discourse.org/u/rootsh3ll)
#### Post date: [23 أكتوبر 2018، 7:09م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/6 "2018-10-23T19:09:12Z")

</div>

> [@terraboss](#):
>
> - … on my iPhone 8+, all of the tags have a thin line on the right next to the flap.
> - … on my iPad mini 4, only some thin lines will appear on the right next to the flap. (e.g. tags with 2 characters)
> - … on my Mac everything is just fine

That’s exactly my issue. In some lines with 2 tags, I see a flap on my iOS device, both safari and chrome. But seems to work fine on on MacOS.

Apart from that, can you change the direction of the triangle in the Tag, like this: ![18%20PM](https://global.discourse-cdn.com/meta/original/3X/7/a/7a15a98b9a1a29027c3d2485b8ad4e6c15348476.png) I tried my beginner CSS skills but couldn’t achieve that. Can you help me out with that?

I changed color of my code to Red (my theme color) and it looks awesome as yours 🙂  
But using colours on tags drives focus on tags constantly rather than the titles which are more important. So I’d still keep the tags in kind of background and content in front.

Here is what it looks like: ![24%20AM](https://global.discourse-cdn.com/meta/original/3X/f/9/f95dcee49b0aa49b99976eb9bf78b7bb1b4404e6.png)  
Just in case somebody else want a red tag on black theme. here is my CSS code for that:

> **CSS for Red Tag on Black Background**
>
> .discourse-tag.box {  
> position: relative;  
> display: inline-block;  
> text-decoration: none;  
> font-weight: normal;  
> background-color: #9c0c16 !important;  
> border-radius: 3px 0 0 3px;  
> height: 20px;  
> line-height: 20px;  
> padding: 0 13px 0 21px;  
> margin: 0 10px 0 0;  
> }  
> .discourse-tag.box::before {  
> position: absolute;  
> content: ‘’;  
> background: #000;  
> border-radius: 100%;  
> height: 6px;  
> left: 7px;  
> width: 6px;  
> top: 7px;  
> box-shadow: inset 0 1px rgba(0,0,0,0.25);  
> }  
> .discourse-tags .discourse-tag.box::after {  
> position: absolute;  
> content: ‘’;  
> background: #000;  
> border-bottom: 11px solid transparent;  
> border-left: 10px solid #9c0c16;  
> border-top: 10px solid transparent;  
> right: 0;  
> top: 0;
> 
> }  
> a.discourse-tag.box {  
> color: #fff !important;  
> font-weight: bold;  
> }

---

<div class="post-metadata">

### Author: ![rootsh3ll](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rootsh3ll/32/119507_2.png) [@rootsh3ll](https://meta.discourse.org/u/rootsh3ll)
#### Post date: [23 أكتوبر 2018، 7:11م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/7 "2018-10-23T19:11:18Z")

</div>

Commenting the code did help. but we loose the beauty of the tag.  
look:

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/e/feef17f9d806a3b4cc42d4df0fb5cbef79f8ff54.jpeg)

flat edges 😑

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [23 أكتوبر 2018، 7:12م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/8 "2018-10-23T19:12:58Z")

</div>

Alternatively, to restyle the bullet to a tag icon:

```css
.discourse-tag.bullet::before {
  font-size: 1.0em;
  top: 0em;
  margin-right: 3px;
  content: "\f02b";
  color: #ccc;
}

```

for:

![21](https://global.discourse-cdn.com/meta/original/3X/5/e/5e39d38ff595783d5b2379a907ba4327ac3da004.png)

---

<div class="post-metadata">

### Author: ![rootsh3ll](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rootsh3ll/32/119507_2.png) [@rootsh3ll](https://meta.discourse.org/u/rootsh3ll)
#### Post date: [23 أكتوبر 2018، 7:16م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/9 "2018-10-23T19:16:46Z")

</div>

That’s also quite cool.  
It is space saver and doesn’t drive focus away from the main content!  
Thanks for sharing 🙂

For people who might discover issue. Just change the tag type from `box` to `bullet` in **Admin** \> **Settings**

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [26 يوليو 2020، 4:10ص UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/10 "2020-07-26T04:10:37Z")

</div>

يجب أن أقول إنني أؤيد فكرة أن تكون التسميات غير مستطيلة الشكل بل تبدو كتسميات. ومع ذلك، فإن استخدام CSS فقط لا يكفي، على الأقل ليس هذا الحل. هذا يعمل فقط على خلفية سوداء حيث لا يظهر المثلث.

![image](https://global.discourse-cdn.com/meta/original/3X/d/9/d9cbabd228fdddb2ada9e87ca39d79871e6940c6.png)

وإلا، يمكن رؤية ما يلي:

![image](https://global.discourse-cdn.com/meta/original/3X/c/9/c93d47b0ec620a4cdfdd4a1087422a000bfb11ad.png)

هناك حاجة إلى طريقة أفضل للقيام بذلك. [https://codepen.io/matt-harris/pen/GqFev](https://codepen.io/matt-harris/pen/GqFev)

---

<div class="post-metadata">

### Author: ![HeyRR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heyrr/32/192157_2.png) [@HeyRR](https://meta.discourse.org/u/HeyRR)
#### Post date: [2 أغسطس 2020، 9:35م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/11 "2020-08-02T21:35:41Z")

</div>

يبدو أن هذا الحل لم يعد يعمل، وهناك إصدار محدث:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/8/6830b3c5c8d121071fc5d187465dd930b3ad386c.png)

(لاحظ أن هذا خاص بنوع الوسم - نقطة، لذا إذا كنت تستخدم نمطًا مختلفًا في الأصل، فسيكون محدد CSS مختلفًا.)

```css
@import url("https://use.fontawesome.com/releases/v5.13.0/css/all.css");

.discourse-tag.bullet::before {
    top: 0em;
    margin-right: 5px;
    content: "\f02b";
    color: #bbbdbb;
    background: none;
    height: 16px; /* قد تحتاج إلى تعديل هذا قليلاً لعرض الهاتف المحمول */
  
    font-weight: 900;
    font-size: 0.9em;
    font-family: "Font Awesome 5 Free"; /* هذا هو خط العائلة الصحيح */
}

```

أو لتقليل التحميل غير الضروري لملف `https://use.fontawesome.com/releases/v5.13.0/css/all.css` بالكامل، يمكنك إزالة سطر `@import` واستخدام SVG كمحتوى:

```css
   content: url('data:image/svg+xml; utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="10" width="10" ><path fill="grey" d="M0 252.118V48C0 21.49 21.49 0 48 0h204.118a48 48 0 0 1 33.941 14.059l211.882 211.882c18.745 18.745 18.745 49.137 0 67.882L293.823 497.941c-18.745 18.745-49.137 18.745-67.882 0L14.059 286.059A48 48 0 0 1 0 252.118zM112 64c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/></svg>');

```

يمكنك العثور على جميع ملفات SVG هنا:

> **[GitHub - Rush/Font-Awesome-SVG-PNG: Font Awesome split to individual SVG and PNG files...](https://github.com/Rush/Font-Awesome-SVG-PNG)**
>
> Font Awesome split to individual SVG and PNG files of different sizes along with Node.JS based generator

---

<div class="post-metadata">

### Author: ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)
#### Post date: [2 أغسطس 2020، 10:46م UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/12 "2020-08-02T22:46:24Z")

</div>

بالنسبة لي، لقد عمل، لكنه لم يكن `.discourse-tag.bullet::before` بل هذا:

```css
@import url("https://use.fontawesome.com/releases/v5.13.0/css/all.css");
    .discourse-tag.box::before {
        top: 0em;
        margin-right: 5px;
        content: "\f02b";
        color: #bbbdbb;
        background: none;
        height: 16px; /* قد تحتاج إلى تعديل هذا قليلاً لعرض الجوال */
      
        font-weight: 900;
        font-size: 0.9em;
        font-family: "Font Awesome 5 Free"; /* هذا هو family الخط الصحيح*/
    }
   .extra-info-wrapper .discourse-tag.box {
        background:none;
    }
    .discourse-tag.box {
        background:none;
    }

```

---

<div class="post-metadata">

### Author: ![HeyRR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heyrr/32/192157_2.png) [@HeyRR](https://meta.discourse.org/u/HeyRR)
#### Post date: [3 أغسطس 2020، 1:22ص UTC](https://meta.discourse.org/t/making-tags-look-like-real-world-tags/100237/13 "2020-08-03T01:22:48Z")

</div>

لقد نسيت أن أذكر أن كودي مخصص لنوع الوسم - النقطة، لذا إذا استخدمت نمطًا مختلفًا، فسيكون محدد CSS مختلفًا.
