开发者

reset css to default settings in span

For our entire website, we have one elaborate CSS file to set page styles.

Because there are so many declarations in th开发者_如何学JAVAe CSS file it is tricky to overwrite all of them for a particular span. Is it possible to reset all CSS in a particular span?


Yeah it's possible, but if you have a bunch of tricky rules, you may have to override all of them. Use FireBug in Firefox to help you determine what rules need to be overridden and when writing new rules, make sure you declare them by class instead of attaching them to the element tag itself.


If it's not already too late, you're much better off avoiding this issue by not setting any styles on plain <span> tags. The same goes for <div> and any other tag (with the possible exceptions of <a> and <h1> & family).

Instead, try to set styles on classes/IDs and then apply those identifiers liberally to the appropriate elements in your HTML.

I've learned this the hard way after running into the same issues you are. Adding styles to base elements just leads to trouble.

Also: it's a good idea to use a CSS Reset to start off your site. This sets everything to a "neutral" state; from there you can style specifically to your heart's content.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜