ijd8.COM

A simple blog for an old Ma Nong.

用纯 CSS 实现的 tag 背景图案

Permalink

用纯 CSS 实现的标签 🏷️ 效果,符合简洁需求,不想引入字体图案的可以这么做。

用纯 CSS 实现的标签效果

HTML: 标签
1
<div class='content'>&#8226; Some Text</div>

CSS: 标签效果
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
body {
  background-color: hsl(198, 83%, 91%);
}
.content:before {
  content: " "; 
	display: block; 
	width: 0; 
	height: 0;
	border-top: 9px solid transparent;
	border-bottom: 8px solid transparent;
	border-right: 8px solid hsl(200, 33%, 58%);
	position: absolute;
	top: 50%;
	margin-top: -9px; 
	right: 100%;
	z-index: 2; 
}

.content {
  background-color: hsl(200, 33%, 58%);
	color: white;
	text-decoration: none; 
  text-transform: uppercase;
	padding: 2px 4px 3px 2px;
	background: hsl(200, 33%, 58%);
	position: relative; 
	display: block;
	float: left;
  position:relative;
  font-size: 13px;
  height: 15px;
}

Write a Comment

Submit Comment Login
Based on Golang + fastHTTP + youdb | go1.16 Processed in 10ms