Is there a standard CSS margin/padding/etc. for HTML elements? - html

I believe WordPress does something like this, they use a CSS reset stylesheet, then manually apply a global margin for each HTML element (to increase browser compatibility). I'm looking for something like this, but without the WordPress specific elements.
On a similar note, is there a default stylesheet that WebKit uses that I can access?

You may want to consider using normalize.css as opposed to a reset.css; checking their demo seems to indicate this includes standards for form elements:
http://necolas.github.com/normalize.css/

a quick google search turned up this: http://meyerweb.com/eric/tools/css/reset/ and this: http://html5doctor.com/html-5-reset-stylesheet/ among others

I generally use YUI Reset CSS for this. YUI Base CSS can complement Reset by applying a style foundation for common HTML elements that is consistent across A-grade browsers. YUI is from Yahoo and hence enjoys good support and is presumably more reliable than other similar CSS frameworks.

default Chrome WebKit http://codesearch.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/css/html.css
here's a butt load more default user agent style sheets
http://meiert.com/en/blog/20070922/user-agent-style-sheets/

There's no standard CSS margin etc. that I know of...
That's one of the reasons why a reset stylesheet is necessary. No one sets the same styles and most browsers have different defaults.
For me, once I reset margin and padding on most elements, I usually make the margin around 1em for p, h1-h5, etc.

Related

Does the Normalize.css works fine if I add it as second css stylesheet or does it overwrite something?

as above mentioned i am not sure if my CSS file for resetting the default browser settings works fine if I add it as a second stylesheet link. Can u help me? Thanks
Normalize.css overwrites lots of things. That's the point of it.
Your rules might be written in such a way that they are more specific that the ones in normalize.css, or they might not.
Normalize.css is a CSS(Cascading Style Sheets) file that provides better cross-browser consistency in the default styling of HTML elements. It corrects different kind of common bugs in browsers.Such as,
common desktop and mobile browser bugs that are out of scope for resets,
display settings for HTML5 elements,
correcting font-size for preformatted text etc..
So as above mentioned, Normalize.css contain styles that apply globally to all native HTML elements. So if you import Normalize.css not as the first stylesheet of your project may override some other importent styles which you have declared in other CSS files which you imported before the Normalize.css file.
I hope that below link will be helpful for you:
https://yuilibrary.com/yui/docs/cssnormalize/

Is it worth using *{margin:0; padding:0;} as resetting purpose

I am beginner at HTML and CSS and faced the confusion about if it is ok to use *{margin:0; padding:0;} or it really affects performance of the web page. I have already read the other article about it in the platform but some responders say that it affects and some say does not. Please would you give concrete answer if *{margin:0; padding:0;} affects the performance or not. I really need your help.
If you reset all elements maybe performance is not big a deal here or difference for performance is not countable, specially nowadays browsers are faster.
By reseting basically you have to write style for every elements and
on the other hand you have to think about cross browser consistency
and think about bugs like SVG overflow in IE9, font-size rendering
for pre element......etc.
Basically if you like built in style and care about css file size then use normalize css.
If you don't like built in styles like default margin or padding for H1-H6,P..etc and care more about cross browser consistency then use reset css.

What is normalized css?

My question is very basic but i didn't find its answer on stack overflow. I like to know how to use normalized.css in "CSS" files. I know that normalized.css help you to make CSS files that can be used in any browser.
normalized.css like yahoo's reset.css and a few others (HTML 5 doctor reset, Vanilla unreset, Universal * reset) aim to make all/most browsers by default look as similar as possible so that you can start from there and then only add the CSS you need that deviates from that point.
Every browser have some predefined css for different HTML tags and css is usually different for different browsers. Like some default padding or margin on div or body. Normalize css just reset everything. So the css you added will show exact same effects in every browser.
Normalize.css is an open source .css file that Nicolas Gallagher made on GitHub: https://necolas.github.io/normalize.css/
It allows you to apply a "Reset" to your code in order to let most modern browsers use your CSS. To use it, you need to link to it in your HTML like you would any other CSS, but make sure it's above the main stylesheet so that the "Reset" is applied before your own styles.
http://adamkaplan.me/css-workshop/#normalize

Reasons not to use a CSS reset?

I heard that many developers are not recommending using CSS reset, what are the reason for it?
for example:
What are the rules for portable CSS?
When using a CSS reset, lots of HTML elements become unusable : titles are small border-less and margin-less, input elements are misformed, etc... You need to restyle all these elements, which is more work.
Some people think that this process of destyling/restyling is unnecessary, error-prone, and that it removes some necessary differences between platforms. Most notably, input elements are typically styled by a browser according to its host platform (windows, mac, etc...) and some people think that UI consistency should be respected even inside a browser.
CSS Reset is found there to normalize the CSS across browsers and gives you easier and more intuitive design possibilities.
For instance, when you use <h1> without a CSS reset/normalization, it will have larger font-size, some margins, and a bold font-weight, with a CSS reset, it would look like a normal text, and it allows you to shape it the way you want, without worrying about the browser defaults which may vary between browsers.
The question you should ask yourself, do you want it?
Remember that a CSS reset does not have to be absolute, if you want to remove all margins and paddings, but retain font size and weight, you could use the classic * { padding: 0; margin: 0; } rather then using a full-powered CSS reset.
If you are making a website,
and you know html & CSS like the back if your hand,
and you can test directly on all major operating systems without compromise,
You're proficient in correcting errors/conflicts with old browsers,
or you are making a website for one browser only.
You may not need a CSS reset or it would be best for you to make your own.
But if you're making a typical modern website and you want to avoid
cross browser conflicts, a reset sheet should "set" the html elements to a similar
playing field.
Many reset sheets interfere with styling too much, all you really want is a default like CSSesta or Eric Meyer's

When is it necessary to initialize or reset all tags using a wildcard * at the beginning of external CSS style?

When is it necessary to use a wildcard * to reset or initialize all tags at the beginning of a CSS document?
It is never necessary, some people just prefer to start from a known baseline rather then the various different browser defaults.
Slapping it in a wildcard isn't really recommended though as it can have unwanted effects on certain elements (such as form controls). This has resulted in slightly more complex resets such as Eric's or Yahoo!'s.
The reset files David referres to are really helpful to clean up the default markup of the different browsers, but keep in mind that you must hard-style a lot of elements. Lists, headers and other elements look really ugly without any kind of markup. I usually have on top of my stylesheet a couple of rules to rewrite some basic markup that every website uses anyway.
There's a good discussion of resets here.