css标签中的标签样式_CSS Gmail样式标签

css标签中的标签样式

css标签中的标签样式

Ever wondered how to generate some cool gmail labels in css? Here is an attempt to imitate the little labels used in gmail. Three tiny colorless images are used to create the rounded borders and the hover effect for the x (removing a label).

有没有想过如何在CSS中生成一些很酷的gmail标签? 这是一种尝试模仿gmail中使用的小标签的尝试。 三个微小的无色图像用于创建圆形边界和x的悬停效果(删除标签)。

The colors are defined in an own class for every li element and so it is very easy to adapt these tiny little fellas to your own needs. Here are some examples:

颜色是针对每个li元素在自己的类中定义的,因此很容易使这些微小的小家伙适应您自己的需求。 这里有些例子:

labels

You can see a demo here: Gmail style labels DEMO

您可以在此处查看演示: Gmail样式标签DEMO

The html structure is made up of an inline list with a span and a link element (the x for removing the label). Unlike in the other posts, I want to start with the html:

html结构由带有范围和链接元素(用于删除标签的x)的内联列表组成。 与其他文章不同,我想从html开始:


<ul class="labels">
 <li class="blue"><span>blue label</span><a href="#"></a></li>
 <li class="lightblue"><span>light blue label</span><a href="#"></a></li>
 <li class="brown"><span>brown label</span><a href="#"></a></li>
 <li class="olive"><span>olive label</span><a href="#"></a></li>
 <li class="pink"><span>pink label</span><a href="#"></a></li>
 <li class="green"><span>green label</span><a href="#"></a></li>
 <li class="violet"><span>violet label</span><a href="#"></a></li>
 <li class="orange"><span>orange label</span><a href="#"></a></li>
 <li class="turk"><span>turkoise label</span><a href="#"></a></li>
 <li class="red"><span>red label</span><a href="#"></a></li>
 <li class="lime"><span>lime label</span><a href="#"></a></li>
 <li class="darkblue"><span>dark blue label</span><a href="#"></a></li>
 <li class="autumn"><span>autumn label</span><a href="#"></a></li>
 <li class="yellow"><span>yellow label</span><a href="#"></a></li>
 <li class="purple"><span>purple label</span><a href="#"></a></li>
 <li class="frost"><span>frost label</span><a href="#"></a></li>
 <li class="black"><span>black label</span><a href="#"></a></li>
</ul>

The first part of the css which you have to put into the header of your html or into your existing stylesheet looks as follows:

您必须放入html标头或现有样式表中的css的第一部分如下所示:

/*General Label Style*/

ul.labels{
 font-family: Verdana,Arial,Helvetica,sans-serif;
 font-weight: 100;
 line-height: 13px;
}
ul.labels li{
 display: inline;
 color: #CCCCCC;
 float: left;
 margin: 0px 2px 2px 0px;
 height: 13px;
}

ul.labels li span{
 background: url(label_front.gif) no-repeat center left;
 font-size: 11px;
 font-weight: normal;
 white-space: nowrap;
 padding: 0px 3px;
 color: white;
 vertical-align: top;
 float: left;
}

ul.labels li a{
 padding: 1px 4px 0px 11px;
 padding-top  /***/: 0px9; /*Hack for IE*/
 background: url(labelx.gif) no-repeat center right;
 cursor: pointer;
 border-left: 1px dotted white;
 outline: none;
}
ul.labels li a:hover{
 background: url(labelx_hover.gif) no-repeat center right;
}

In order to give some color to the labels, we have to define some new classes:

为了给标签添加颜色,我们必须定义一些新的类:

/*Colored Label Attributes*/

ul.labels li.pink{
 background-color: #F1A9E7;
}
ul.labels li.lightblue{
 background-color: #99CCFF;
}
ul.labels li.blue{
 background-color: #3019FF;
}
ul.labels li.olive{
 background-color: #CCCC66;
}
ul.labels li.green{
 background-color: #37B700;
}
ul.labels li.brown{
 background-color: #C5AD98;
}
ul.labels li.violet{
 background-color: #CEA6CE;
}
ul.labels li.turk{
 background-color: #8FCDB6;
}
ul.labels li.red{
 background-color: #EE998A ;
}
ul.labels li.orange{
 background-color: #FF9E28 ;
}
ul.labels li.lime{
 background-color: #B6FF00 ;
}
ul.labels li.darkblue{
 background-color: #21007F ;
}
ul.labels li.leaf{
 background-color: #00CC00 ;
}
ul.labels li.yellow{
 background-color: #FFFF00 ;
}
ul.labels li.autumn{
 background-color: #B24700 ;
}
ul.labels li.frost{
 background-color: #80C8FE ;
}
ul.labels li.purple{
 background-color: #8E006B ;
}
ul.labels li.black{
 background-color: #000 ;
}


This makes it really easy to change the appearance of a label.

这使得更改标签的外观非常容易。

The images needed to create the rounded borders effect and the x hover effect are small gifs that you will find in the downloadable zip. This works fine with Mozilla, IE (I had to put a 0px hack, sorry), Chrome and Safari. With Opera there is some major problem, I have no idea why, there seems to be an issue with images in list elements. Any ideas are welcome!

创建圆角边框效果和x悬停效果所需的图像是可在可下载的zip中找到的小gif文件。 可以在Mozilla,IE(我不得不添加0px hack),Chrome和Safari上正常运行。 对于Opera,存在一些主要问题,我不知道为什么,列表元素中的图像似乎存在问题。 任何想法都欢迎!

I hope it is useful! Here is the complete source with images:

我希望它是有用的! 这是带有图像的完整资源:

Gmail style labels download

Gmail样式标签下载

翻译自: https://tympanus.net/codrops/2009/08/29/css-gmail-like-labels/

css标签中的标签样式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
HTML的table标签,可以使用CSS样式来美化表格的外观。以下是一些常用的CSS样式属性和值,可以应用于table标签: 1. border-collapse:设置表格边框的合并方式。常用值有: - collapse:相邻单元格的边框会合并为一个单一的边框(默认值)。 - separate:相邻单元格的边框会保持独立。 2. border-spacing:设置相邻单元格之间的间距。常用值有: - 像素值:例如 "5px",表示相邻单元格之间的间距为5像素。 - 百分比值:例如 "10%",表示相邻单元格之间的间距为单元格宽度的10%。 3. width:设置表格的宽度。常用值有: - 像素值:例如 "500px",表示表格的宽度为500像素。 - 百分比值:例如 "80%",表示表格的宽度为父容器宽度的80%。 4. background-color:设置表格的背景颜色。常用值有颜色名称或十六进制颜色码。 5. text-align:设置表格内容的水平对齐方式。常用值有: - left:左对齐。 - center:居对齐。 - right:右对齐。 6. vertical-align:设置表格内容的垂直对齐方式。常用值有: - top:顶部对齐。 - middle:居对齐。 - bottom:底部对齐。 7. font-size:设置表格内容的字体大小。常用值有: - 像素值:例如 "14px",表示字体大小为14像素。 - 百分比值:例如 "120%",表示字体大小为默认大小的120%。 这些是一些常用的CSS样式属性和值,可以根据需要进行组合和调整,以实现不同的表格样式效果。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值