A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 102

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 128

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$hooks is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$config is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$log is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$uri is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$router is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$output is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$security is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$input is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$lang is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$db is deprecated

Filename: core/Loader.php

Line Number: 397

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_DB_mysqli_driver::$failover is deprecated

Filename: database/DB_driver.php

Line Number: 372

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$email is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 303

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 328

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 355

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 365

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 366

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 367

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 368

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 426

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Session cannot be started after headers have already been sent

Filename: Session/Session.php

Line Number: 137

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$session is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$pagination is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Blog::$zip is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$db is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$email is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$session is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$pagination is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$zip is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /www/wwwroot/SINHCOMS/VT/main/application/controllers/Blog.php
Line: 20
Function: view

File: /www/wwwroot/SINHCOMS/VT/main/index.php
Line: 160
Function: require_once

Vismrit Tech | Home Startup
Classes
Blog Author
Theresa Underwood
  • Sep 10, 2021
  • 9 min to read

The class attribute is often used to point to a class name in a style sheet. It can also be used by a JavaScript to access and manipulate elements with the specific class name.

CSS classes are commonly used to define a set of CSS styles and then apply them on an HTML element using selectors. To define a class within a CSS stylesheet, use the dot selector, as follows:

<style>
.nice {
    font-family: sans-serif;
}
</style>

Each HTML element can have a set of classes, ordered in a specific order. Each class will potentially add a set of CSS definitions according to the styles that were defined in the page. In this piece of code we have defined a CSS rule that will be applied to every element that contains the "nice" class. This means that once this piece of code has been defined inside the HTML page, the following HTML paragraph will have the style applied to it:

<style>
.nice {
    font-family: sans-serif;
}
</style>
<p class="nice">This is a short sentence.</p>

HTML5 classList API

HTML5 introduced a new way to edit the class list of an element using the classList collection. Each HTML element returns the collection by accessing the element.classList member. The class list allows to add, remove, toggle and to check if an element contains a specific class.

Let's see an example:

<!DOCTYPE html>
<html>
<head>
    <style>
    .nice {
        font-family: sans-serif;
    }
    </style>
</head>
<body>
    <p id="mytext">My text</p>
    <script>
        var el = document.getElementById("mytext");
        el.classList.add("nice");    // adds the nice class to the paragraph
        el.classList.remove("nice"); // removes the nice class from the paragraph
        el.classList.toggle("nice"); // adds the nice class to the paragraph again, since it does not currently
                                     // contain the nice class.

        if (el.classList.contains("nice")) {
            alert("The element contains the 'nice' class.");
        }
    </script>
</body>
</html>

Since HTML5 is a relatively new standard, it is not supported on all browsers. It is safe enough to use today though. Here is the compatibility table for the feature: http://caniuse.com/#search=classlist

Exercise

This page does not have an exercise yet. You are welcome to contribute one by sending me a pull request:

https://github.com/ronreiter/interactive-tutorials

Comments:

Blog Comment
Sophie Asveld

February 14, 2021

Email is a crucial channel in any marketing mix, and never has this been truer than for today’s entrepreneur. Curious what to say.

Blog Comment
Ariana Gerad

February 14, 2021

Email is a crucial channel in any marketing mix, and never has this been truer than for today’s entrepreneur. Curious what to say.

Blog Comment
Sophie Asveld

February 14, 2021

Email is a crucial channel in any marketing mix, and never has this been truer than for today’s entrepreneur. Curious what to say.

Leave a comment:

Contact Information

Sinhcoms
Nalanda Bihar, India

We're Available 24/7. Whatsapp Now. (+91) 9123288803 (121)255-53333
Find us here