关于:target使用的简单实验

INTRO: CSS3的大潮即将到来,自己体验一把,target的简单效果。如果和js结合会有更酷的体验。

自己做一个关于:target的简单实验。ff3.x浏览可见效果,IE系列暂不支持。

:target是CSS3新推出的一个伪类选择器,作用于那些使用了锚标记name的链接。而通过:target可以针对指定的target对象定义样式。在这些target被激活时,可见这些样式的变化。

为了更好地展示:target的效果,首先需要几个文字段落。文字段落引自W3C对于:target的解释。

  1. 段落一
  2. 段落二
  3. 段落三

段落一:
Some URIs refer to a location within a resource. This kind of URI ends with a “number sign” (#) followed by an anchor identifier (called the fragment identifier).

段落二:
URIs with fragment identifiers link to a certain element within the document, known as the target element.

段落三:
A target element can be represented by the :target pseudo-class. If the document’s URI has no fragment identifier, then the document has no target element.

TOP

CSS:

1
2
3
4
5
*:target{
    padding:10px;
    border:dotted 1px #ddd;
    color:#799B13;
}

或许您对这些文章也感兴趣:

希望得到您的评论

(匿名是不被允许的)
(不会被公开)

DecImage.com 印象十二月 遥记那一季西部行

你不能逃避你的弱点,要不就奋起反击,要不就坐以待毙。如果真的是这样,为什么不从此时就开始呢?——Robert Louis Stevenson
感谢阅读我的文章,如果您需要订阅:RSS Feed | Comments RSS Feed

> 推荐两本看过的书

  • 艽野尘梦艽野尘梦全书5万多字,文言文书写,纸薄情长。读完全书,你必从此不会忘记一个叫西原的女子。
  • 幸福的建筑幸福的建筑阿兰·德波顿说他对任何的装饰都深恶痛绝,故我觉得他会和我一样喜欢北欧极简主义。
  • >友情链接

  • 零九的十二月 我在西部游走 像一个孩子一样