H
H
Hello World2019-09-15 12:12:32
css
Hello World, 2019-09-15 12:12:32

Why does the browser automatically have padding on the sides?

Why does the browser automatically have side margins when writing HTML code?
How to remove them please give advice.5d7e00b47543d020989672.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2019-09-15
@kartoxa18

The browser by default sets page indentation: css-property marginfor html-tag body.
To remove unnecessary indentation, it is considered bad practice to write the following css:

* {
    margin: 0;
    padding: 0;
}

Reason - Adds unnecessary code to elements. Most already have zero default indents, while others (for example, headings, lists) usually have their own.
Experienced guys reset indents and other styles with reset.cssor normalize.css. Cons of this trip:
Yandex advises not to use asterisk selectors, not to reset styles, but to write universal blocks. Your case:
.page {
    margin: 0;
}

Source

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question