What does it matter wheater I use:

p.center
{
text-align: center;
}

And HTML:

<p class="center">
Text.
</p>

Or I use:

#paragraphs p
{
text-align: center;
}

And then HTML:

<div id="paragraphs">
<p>
Text.
</p>
</div>

Could somebody explain please?

Thank You.

The difference is that an ID references a unique element on the page...i.e. there is only one element on the whole page with the ID.

A class can be used to name several different elements on the page.

In other words, you can have one div with a specific ID, but multiple divs with a specified class.

In your case, you would probably want to use a class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.