css unicode_Unicode CSS类

css unicode

CSS class name structure and consistency is really important; some developers camelcase classnames, others use dashes, and others use underscores.  One thing I've learned when toying around by HTML and CSS class names is that you can actually use unicode symbols and icons as classnames.  Check this out!

CSS类名称的结构和一致性非常重要; 一些开发人员使用驼峰式类名,其他开发人员使用破折号,而其他开发人员则使用下划线。 我在遍历HTML和CSS类名时学到的一件事是,您实际上可以使用Unicode符号和图标作为类名。 看一下这个!

HTML和CSS (The HTML and CSS)

There's only one way to add a classname with HTML so you'll do it that way, of course:

只有一种方法可以使用HTML添加类名,因此您当然可以这样做:


<!-- place this within the document head -->
<meta charset="UTF-8" />

<!-- error message -->
<div class="ಠ_ಠ">You do not have access to this page.</div>

<!-- success message -->
<div class="❤">Your changes have been saved successfully!</div>


...and there's only one way to declare styles for a given class:

...并且只有一种方法可以声明给定类的样式:


.ಠ_ಠ {
	border: 1px solid #f00;
	background: pink;
}

.❤ {
	background: lightgreen;
	border: 1px solid green;
}


Wild that you can use unicode classnames for elements, right?  Of course I don't recommend doing so, but you can if you'd like to!

可以为元素使用unicode类名,对吗? 当然,我不建议您这样做,但是如果您愿意,可以这样做!

翻译自: https://davidwalsh.name/unicode-css-classes

css unicode

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值