最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can we disable default browser style properties for elements? - Stack Overflow

programmeradmin2浏览0评论

Having issue in design on forms and links on a page I created because of the browser style properties. How can I disable it so that no elements in my html page gets affected by the browsers' default style property?

All solutions are wele. I am using php for development. So all solutions with css, javascript, php etc are weled.

Having issue in design on forms and links on a page I created because of the browser style properties. How can I disable it so that no elements in my html page gets affected by the browsers' default style property?

All solutions are wele. I am using php for development. So all solutions with css, javascript, php etc are weled.

Share Improve this question asked May 21, 2014 at 8:58 AeJeyAeJey 1,45720 silver badges41 bronze badges 7
  • 5 CSS reset – link Commented May 21, 2014 at 8:59
  • Isn't there any single line code/statement available for disabling the entire browser default style? – AeJey Commented May 21, 2014 at 9:03
  • 1 There is: <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare./ajax/libs/normalize/3.0.1/normalize.min.css"> – Prasanth Commented May 21, 2014 at 9:04
  • @AeJey If you could disable them, how should any element be displayed if it had no style? – Pablo Lozano Commented May 21, 2014 at 9:05
  • 2 If there was something else, all those CSS reset stylesheets probably wouldn't exist :) – link Commented May 21, 2014 at 9:06
 |  Show 2 more ments

5 Answers 5

Reset to default 2

You can maybe put !important behind the css you want to overwrite the default style properties?

maybe this solves your solution?

You cannot disable browser default style sheets, just override them by setting properties to specific values. It is mon to confuse the two.

This is a decision by browser vendors. They could give a page (scripts on a page) access to the browser’s stylesheet allowing it or parts thereof to be disabled. But they haven’t done that.

There must be a default style for all elements, so you cannot just disable them. The usual way to handle this issue is adding your desired defaults in a base CSS file, overwriting the browser's defaults.

As @link mented, http://www.cssreset./ provides several default styles to be applied as base in your pages.

Please use normalize css :

http://necolas.github.io/normalize.css/

It'll help you.

You need to override browser's default stylesheet. You can do it many ways-

  • Manually define every elements style
  • Use any reset.css (You can find many)
  • Use a basic html startup tamplate, which covers everything you need. You can find one here, It has many options to choose from.

Hope you will love it :-)

发布评论

评论列表(0)

  1. 暂无评论