a:链接周围div - 造型在div [英] a:link around div - styling inside div

查看:130
本文介绍了a:链接周围div - 造型在div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div,我想要点击,所以我围绕它包装一个a标签,因为它是有效的HTML 5,并使div的块级元素。

I have a div that I want to be clickable, so I've wrapped an "a" tag around it, as it is valid HTML 5 and made the div a block level element.

现在,我遇到的问题是样式的内容在div,因为一切都显示为链接,尽管尝试众多的方法,我没有找到一个好的解决方案自定义样式的一切内的div。

Now, the problem I'm having is styling content inside that div, as everything displays as a link, and despite trying numerous methods I haven't found a good solution for custom styling everything inside the div.

可以在这里查看缩减的测试示例:

A reduced test sample can be viewed here:

http://codepen.io/anon/pen/aencq

所以,我的问题基本上,什么是最好的方式样式化元素,如h2和p在一个块级别的div,包装与一个:链接。

So, my question is basically, what's the best way of styling elements such as h2 and p that are inside a block level div, that is wrapped with an a:link.

推荐答案

这里需要的是:

a { color:black; text-decoration:none; }

有时你会想要更具体,然后你可以像:

Sometimes you'll want to get more specific and then you can be like:

a h2 { color:red; }

这篇关于a:链接周围div - 造型在div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆