How to learn HTML and CSS?

Both can write HTML and CSS in the same document, yes.

For example:

<html lang="en">
#hello {
    color: #e74c3c;
    font-size: 25px;
    <p id="hello">Hello world!</p>

(The CSS goes inside the style tags)

As far as learning these two languages go, there are lots of resources available for a beginner, such as codecademy, and W3 schools: HTML & CSS. Beginner could also follow a simple web development video course such as this one.

Along the way, you'll also probably discover JavaScript, which is used to add feedback to the user on a website. The basics can be found here at this W3 schools link, although it's probably best to learn HTML and CSS before moving onto this.