Polly
Polly

Reputation: 11

How to connect one css with multiable html pages

So I new to html and want to make a website with 2 pages a home page and a contact page. and I just want to know how do you use the same Style.css file for then 1 page?

Do just write in the Style.css: ***#Home body;

#Contact body;***

Upvotes: 0

Views: 263

Answers (1)

Abhilash Asokan
Abhilash Asokan

Reputation: 348

For ease of explaining, i have created 2 divs in one page. But you can create homepage and put "homepage" div in it and "contact" div on another page

.homepage {
    /* All css needed for homepage will come here */
}

.contact {
    /* All css needed for contact will come here */
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="homepage">
        page 1 content
    </div>

    <div class="contact">
        contact content
    </div>
</body>
</html>

Upvotes: 1

Related Questions