V.Vidhya Logo

V.Vidhya

Manipulating Attributes & Style


We have a sample web-page which looks like this.

Image 5

Below, are the respective HTML & CSS files for this web-page.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JS Basics</title>

    <link rel="stylesheet" href="styles.css" />
</head>
<body>
    <h1 id="main-heading">JavaScript (Intermediate)</h1>

    <div class="sub-section">
        <h2 id="sub-heading">Basics of DOM</h2>
        <p>DOM - Document Object Model</p>
    </div>

    <h3>Main-Topics of Front-end Web Development</h3>
    <ul>
        <li class="list-items">
            <div>
                <img src="html.png" alt="HTML-icon" />
                <span>Hyper Text Markup Language</span>
            </div>
        </li>
        <li>
            <div>
                <img src="html.png" alt="CSS-icon" />
                <span>Cascading Style Sheet</span>
            </div>
        </li>
        <li>
            <div>
                <img src="html.png" alt="JS-icon" />
                <span>JavaScript</span>
            </div>
        </li>
    </ul>

    <img src="webdev.png" alt="webdev" />
    
    <h3 class="topic-heading">Let's learn!</h3>
    <button>Enroll</button>

    <script src="app.js"></script>
</body>
</html> 
#main-heading {
    text-decoration: underline solid;
    background-color: orange;
}

.sub-section {
    padding-bottom: 30px;
}

#sub-heading {
    text-decoration: underline dashed;
    background-color: yellow;
}

.topic-heading {
    text-decoration: underline double;
    text-underline-offset: 5px;
    color: green;
}

.list-items {
    color: red;
    font-weight: 600;
    padding-bottom: 20px;
}

.list-items div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    font-weight: bold;
    font-size: 25px;
    padding: 20px 50px;
}

.btn-active {
    background-color: lightgreen;
    border: 5px solid green;
}

.btn-inactive {
    background-color: orange;
    border: 5px solid red;
}

Below, all the image assets used for the above page are provided.

Image 4 Image 1 Image 2 Image 3

While naming your image files and choosing their directory location, please follow the above HTML code. If you won’t name & put the files according to HTML, it won’t be able to find the image files. Though if you know what you are doing then you can use whatever assets you like and store them wherever you want, by changing the HTML as per your needs.

Currently there are some inconsistencies within this page, we have to fix it by manipulating the HTML & CSS using JS.

Let’s fix it one by one.


Prev Post
Object Selection & Setting Content (DOM)
Next Post
DOM Cumulative I