开发者

What other elements apply styling, like body and paragraph do?

开发者 https://www.devze.com 2023-04-03 08:53 出处:网络
I found that body tags, and paragraph tags add margins and spacing, so I was wondering what other elements have unique styling properties.

I found that body tags, and paragraph tags add margins and spacing, so I was wondering what other elements have unique styling properties.

Also, what would be an good way to disable them? What I have now is:开发者_C百科

body, h1, h2, h3, h4, h5, h6, p, a, {
  border: 0 none;
  font-family: inherit;
  font-size: 100%;
  font-style: inherit;
  font-weight: inherit;
  margin: 0;
  outline: 0 none;
  padding: 0;
}


The major difference is some elements are "block" and some are inline. However, that can be changed as well.

a {
 display:block;
 height:100px;
 width:600px;
 margin:auto;
 background:url ...
}

So to answer your question all elements. Even your own ...

<script>
document.createElement("myelement"); 
</script>
<style>
myelement {
 display:block;
 width:300px;
 height:300px;
}
</style>
<html>
<myelement>I've made my own standard - but it does not validate with html checkers</myelement>
</html>

This allows html5 elements to be created for non HTML5 browsers ... http://net.tutsplus.com/tutorials/html-css-techniques/how-to-make-all-browsers-render-html5-mark-up-correctly-even-ie6/

W3C does not want you to create myelements though.


blockquote, em, strong are a few others. If you want to work with the assumption that nothing has style, you could set the defaults to *{ } as * selects all elements.


Pretty much every element (except span, I think) has a default styling. But other that have default margin/padding are ul and ol.

If you want to disable them, you can use the global CSS selector, *.

* {
    /* Default styles */
}
0

精彩评论

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