answersLogoWhite

0


Best Answer

A CSS class is a line of code in your CSS file which corresponds to the HTML equivalent of that class; it is defined with a dot: "."

<div class="test">This is a test.</div>

CSS:

.test { display: block; background: #f90; color: #fff; }

The classes are used to define the style for the individual element of the web page or to determine different styles for the one tag. Syntax for the classes will be the following:

Tag.Name of class { property1: value; property2: value; ... }

Inside of the style sheet the desirable tag is written first, than, after the semicolon - the user's class name. In order to define in HTML code the fact, that tag with the definite style is used, parameter is added to the tag

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Class defines the element's style. That way, when you have multiple elements which has the same look and style, you don't have to repeat typing in the code for style.

Example

<head>

<style>

span.blue{background-color:#0000ff;}

(.blue is the class)

</style>

</head>

<body>

<span class="blue">Blue</span>

</body>

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

A class in CSS could be used to refer a value. A dot symbol is used to refer a class anywhere in program.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of a class in css?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you apply css code in HTML?

"class" is an attribute of most if not all HTML tags. To apply a CSS class to a tag, simply make the class attribute equal to that CSS class. For example, suppose you have a CSS class called bigRed that makes text large and red. If you want to apply it to a certain text, just put it in a tag surrounding that text. e.g. . . . but my &lt;span class='bigRed' &gt;car&lt;/span&gt; was faster than . . .


How do I make a favicon?

You will not use CSS for this purpose.


How do you change the CSS for a table?

The table tag will have a class associated with it, there you can find which css class it is using. Then go into style sheet and adjust the styles you would like reflected in table.


What is using a css class in a body section called?

Using CSS class in a body section is called inline style. You can use styles inside most HTML tags.


How can you add images into a css class and display it using span tag?

You would give the CSS class a background of that image, then assign it using a class attribute in your span tag. For example, your class's name will be class1, and your image will be named 'myimage.jpg'. CSS: .class1{ background-image:url('myimage.jpg'); } Then, for your HTML span tag: &lt;span class="class1"&gt; Add a lot of '&amp;nbsp;' here until you can see your image. &lt;/span&gt;


What is a custom CSS?

All CSS is custom, that is the purpose behind CSS. It allows you to control the presentation of your web pages and separate the rules that govern presentation from the content and markup. You control what rules you develop and set the rules for. CSS stands for cascading style sheets.


Css code ul class?

to modify any HTML tag just type the tag as the css property eg. ul { /*your css here*/ }


What selector should you use when applying a style to multiple elements in CSS?

The easiest thing is to use a class. Add class="foo" to your elements. And add this code to your CSS:.foo {border: solid 1px #000000;//Or something like that.}


What is the purpose of cascading styles sheets?

CSS is used to style web pages in the WWW!


Why does a css class not work in fire fox?

CSS classes do work in FireFox. What is the main problem? (specifically)Have you checked that the syntax is correct?There is a lot to learn about things with CSS and browsers, you may need a hack or fix, if all else fails.


How do you change Css class of an element with javascript?

//Find the object in the DOM, and set its new class name: document.getElementById['elementIdName'].className = "nameOfYourNewClass";


How do align center in java script?

You do it using CSS. You can add CSS styles to the style attribute to an element and assign it the "text-align:center" value, or you can use a class that is pre-build in your CSS. Classes, in this case, will simplify your JS code, but make it less self-contained.