I just need to know the difference between putting property in html or body tag why both , if I can put css property in one tag

html {
height: 100%;
margin: 0 auto;
overflow-x: hidden;
width: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}

body {
height: 100%;
margin: 0 auto;
overflow-x: hidden;
width: 100%;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
} :innocent: :innocent:

You phrased your sentence very weirdly. " [I just need to know the difference between putting property in html or body tag why both , if I can put css property in one tag" Is not a very good way of asking the problem but this is what I was able to find on the web for your “problem”.

Google: In content management systems, it is a common practice to place a list of content-specific CSS classes into the element. This allows designers and JavaScript developers to target pages based on specific content attributes, such as category, tags, or content type.

If this didn’t help you then my apologies for miss-understanding your question, please re-write it. I haven’t wrote HTML or CSS in a while so I’m a little rusty on them but I know it has to do with the fact that the “html {” and “body {” aren’t the same. The code that is in the “body {” is affected when you change anything in it but when you change something in “html {”. I believe you change the full page if I’m not wrong, You can always do “* {” as well if you want the CSS to affect the entire page/code.

1 Like

thanks for helping I get your point
what i wanted to say that best practice to but elements in css body selector or html selector .
thanks for helping .

You’re welcome, hope it helped.

1 Like