MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

CSS Tutorial for beginners (Step by Step) with Examples(Part3).

i. Universal Style Class

It is a type of style class which is used by any element of the HTML document. Universal Style Class Starts with a dot(.) operator and followed by the Class name.

Syntax

<style>

.classname { class properties } [ Note :- no space between class_name]

</style>

For Example :-

<style>

.class { color: red; font-size: 30px;}

</style>

Sample Program

Output

Style class output: red heading and large red second paragraph, first paragraph unstyled

ii. Element Specific Style Class

It is a type of style class which is used by a specific element(declared before class name) of the HTML document. An element specific style class starts with the element name, followed by a dot(.) operator, which is followed by a class name.

Syntax :-

<style>

elementname.classname { class definition }

</style>

For Example :-

<style>

p.sushant { color:blue; font-size:35px;}

</style>

[Note :- Here, sushant class is used by p element only and if we declare the class in other elements then it doesn’t work.]

Sample Program

Note :- In the above sample program, the class is called in h1 tag as well as in p tag, but class property works only with p tag because of the element-specific style class. See the output Below :-

Output

Element-specific class output: only the second paragraph is large and red, heading stays black

How to use two or more classes in CSS.

We can use two or more classes in an element/tag by giving space between them.

Syntax

Syntax for two classes on one element: p class with class1 and class2 separated by a space

Sample Program

Output

Output of two classes: small centered heading, red first paragraph, centered second paragraph

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

WordPress Typography Patterns: Styled Lists, Notice Boxes, and Code Blocks with Reusable CSS

This guide modernizes a legacy WordPress typography post into practical, reusable patterns for custom list markers, callout boxes, and code styling. It focuses on maintainable CSS and editor-friendly markup you can reuse across posts and documentation pages.

Read More

What to choose: front-end or backend development?

Regarding web development, two main areas play a crucial role in creating a functional and visually appealing website: frontend and backend development. Frontend development focuses on the…

Read More

Building the Virtual Classroom: An Introduction to HTML5 Layouts for Online School Portals

To build a virtual classroom, you need to grasp HTML5 layouts. Use semantic elements like <header>, <nav>, <section>, and <footer> for better accessibility and SEO. Make certain…

Read More

What is Apache Cordova and use cases of Apache Cordova?

What is Apache Cordova? Apache Cordova, formerly known as PhoneGap, is an open-source mobile development framework that allows developers to build mobile applications using web technologies such…

Read More

How to Implement Accessibility in Web Development: Practical Steps and Tools

Making your website accessible to everyone, including people with disabilities, is crucial. Accessibility in web development means ensuring that colors, text, and navigation support all users. Web…

Read More

How to become a Full stack Web developer & App developer?

Platform Dev Tools Web Server Framework Concept Programming & Scripting Languages Becoming a full-stack web developer and app developer requires a comprehensive understanding of both front-end and…

Read More