When do you use <p>
? I know it could be used for text, but do you need to write it if you have already -for example- <article>
? or can I just use <article>
alone then?
Also why do you need to use margin instead of padding on <p>
? I tried already with padding, but that doesn't work. If I tried it with margin it works well.
The HTML <p>
tag is used for defining a paragraph. For example the two sections of your question are paragraphs
Also to add a margin is the space outside something, whereas padding is the space inside something.
For example:
h2 {
font-size: 1.5em;
background-color: #ccc;
margin: 10px;
padding: 20px;
}
This leaves a 10-pixel width space around the secondary header and the header itself is fat from the 20-pixel width padding.