HTML中的类属性

The class attribute in HTML is used to specify or set a single or multiple class names to an element for an HTML and XHTML elements. Its majorly used to indicate a class in a style sheet.

HTML中class属性用于为HTML和XHTML元素指定或设置一个元素名称或多个类名称。 它主要用于指示样式表中的类。

Defining the structure of a class can also be considered as description to class attribute. You can identify them as the opening tags to control an element's behaviour. The class attribute often points to the class in the style sheet. Class attribute can also be taken in use by JavaScript, CSS (Cascading Style Sheet). The class name can be used by JavaScript and CSS to perform task or indulge changes for elements under specified class name; mainly for styling purposes or to add behaviour to elements that fall under particular subtype. Class attribute makes it liable to bring changes to any HTML element.

定义类的结构也可以视为对类属性的描述。 您可以将它们标识为开始标签,以控制元素的行为。 class属性通常指向样式表中的类。 JavaScript,CSS(级联样式表)也可以使用Class属性。 JavaScript和CSS可以使用该类名来执行任务或放任指定类名下的元素更改。 主要用于样式设计或为属于特定子类型的元素添加行为。 使用Class属性可以对任何HTML元素进行更改。

It determines how an element should processed, it will indicate the elements' inheritance and therefore how it should be handled. Name of an element specifies its type but class lets you assign to it one or more subtypes.

它确定元素应如何处理,将指示元素的继承以及因此应如何处理。 元素的名称指定了它的类型,但是类使您可以为其分配一个或多个子类型。

The class attributes cannot be applied to following elements,

类属性不能应用于以下元素

  • Base

    基础

  • Basefont

    Basefont

  • Head

  • Html

    HTML

  • Meta

  • Para

    帕拉

  • Script

    脚本

  • Style

    样式

  • Title

    标题

Class attributes can be used on inline elements.

类属性可用于内联元素。

There can be multiple class names to a single element where each class name must be separated by space between them, and also class attribute value may begin with a number and still be valid HTML unlike id attribute. But it is most likely to be avoided to initiate with a digit.

单个元素可以有多个类名,每个类名之间必须用空格隔开,并且类属性值可以以数字开头,并且仍然是有效HTML(与id属性不同)。 但是最有可能避免以数字开头。

It is recommended to have semantically meaningful name as possible as it would add to the emphasis of the particular subtype to be specific and would provide an eye of interest and ease to those reading the markup. Purely presentational names would help bring maximum eyes on board.

建议使用尽可能在语义上有意义的名称,因为这会增加对特定子类型的强调,并为感兴趣的人提供便利,并使阅读标记的人感到轻松。 纯粹的表述性名称将有助于最大程度地吸引人们的注意。

The syntax which is however the essential format is,

但是语法是基本格式,

    <element class="classname">

有关如何放置class属性的示例? (An example on how to place the class attribute?)

<html>
<head>
<style>
h1.intro {
color: blue;
}
p.important {
color: green;
}
</style>
</head>
<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Any important text. :)</p>
</body>
</html>

All the styling and other changes in behavior in an element or elements that you want to provide to all the elements under the same section which is distinguished due to the class attribute can be applied in effect to every element. This in HTML provides a lot of potentials to work with and deal with several arrays of classes.

您想要提供给同一节下所有元素的一个元素或多个元素的所有样式和其他行为更改(由于类属性而有所区别)可以有效地应用于每个元素。 HTML中的这提供了使用和处理多个类数组的大量潜力。

Different tags can have the same class name and therefore share the same styles as well.

不同的标签可以具有相同的类名,因此也可以共享相同的样式。

The browsers that are compatible with class attributes are,

与类属性兼容的浏览器是

  • Google Chrome

    谷歌浏览器

  • Internet Explorer

    IE浏览器

  • Firefox

    火狐浏览器

  • Opera

    歌剧

  • Safari

    苹果浏览器

It's one of the basic aspects but essential that you need to know in attributes for HTML. And also quite easy to grasp in with.

这是基本方面之一,但您需要在HTML属性中必须了解。 而且也很容易掌握。

翻译自: https://www.includehelp.com/html/class-attribute-in-html.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/543810.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

关于HTML5标签不兼容(IE6~8)

HTML5的语义化标签以及属性&#xff0c;可以让开发者非常方便地实现清晰的web页面布局&#xff0c;加上CSS3的效果渲染&#xff0c;快速建立丰富灵活的web页面显得非常简单。 比较常用的HTML5的新标签元素有&#xff1a; <header>定义页面或区段的头部&#xff1b;<na…

zzz,zzz,zz9_ZZZ的完整形式是什么?

zzz,zzz,zz9ZZZ&#xff1a;睡觉&#xff0c;无聊&#xff0c;累 (ZZZ: Sleeping, Bored, Tired) ZZZ is an abbreviation of "Sleeping, Bored, Tired". ZZZ是“睡觉&#xff0c;无聊&#xff0c;累了”的缩写 。 It is an expression, which is commonly used in …

uboot启动 及命令分析(3)

u-boot命令 先贴一个重要结构,位于uboot/include/command.h,这个结构代表每个uboot命令 struct cmd_tbl_s { char *name; /* Command Name */ int maxargs; /* maximum number of arguments*/ int repeatable;/* autorepeat allowed? */ /* Implem…

Mozilla开源了VR框架A-Frame

Mozilla创建并开源了A-Frame&#xff0c;这是一个用于在桌面浏览器、智能手机和Oculus Rift上创建VR场景的框架。\\A-Frame是一个在浏览器中创建VR体验的开源框架。该框架由Mozilla的MozVR团队创建和开发。A-Frame使用了一个在游戏开发中经常使用的“实体-组件&#xff08;Enti…

css网格_CSS网格容器

css网格CSS | 网格容器 (CSS | Grid Containers) There are numerous ways to display our list items or elements. For instance, we can display them in the navigation bar, in a menu bar and whatnot. Well, it would be right to say that there are many more such me…

c ++向量库_在C ++中对2D向量进行排序

c 向量库As per as a 2D vector is concerned its a vector of a 1D vector. But what we do in sorting a 1D vector like, 就2D向量而言&#xff0c;它是1D向量的向量 。 但是我们在对一维向量进行排序时所做的工作 sort(vector.begin(),vector.end());We cant do the same …

监听文本框数据修改,特别是微信等客户端直接选择粘贴修改

2019独角兽企业重金招聘Python工程师标准>>> // 手机号码信息加载验证 $(input).bind(input propertychange, function() { initPage.checkName(); }); 转载于:https://my.oschina.net/u/1579617/blog/550488

SSIA的完整形式是什么?

SSIA&#xff1a;主题说明一切 (SSIA: Subject Says It All) SSIA is an abbreviation of "Subject Says It All". SSIA是“主题说明一切”的缩写。 It is an expression, which is commonly used in the Gmail platform. It is written in the subject of the mail…

服务器控件转换成HTML

服务器控件转换成HTML<asp:Label ID"Label1" runat"server" Text"I am label"><asp:Literal ID"Literal1" runat"server" Text"I am a literal"><asp:Panel ID"Panel1" runat"serv…

Eratosthenes筛

什么是Eratosthenes筛&#xff1f; (What is Sieve of Eratosthenes?) Sieve of Eratosthenes is an ancient algorithm of finding prime numbers for any given range. Its actually about maintaining a Boolean table to check for corresponding prime no. Eratosthenes的…

微信iOS多设备多字体适配方案总结

一、背景 2014下半年&#xff0c;微信iOS版先后适配iPad, iPhone6/6plus。随着这些大屏设备的登场&#xff0c;部分用户觉得微信的字体太小&#xff0c;但也有很多用户不喜欢太大的字体。为了满足不同用户的需求&#xff0c;我们做了全局字体设置功能&#xff0c;在【设置-通用…

python矩阵中插入矩阵_Python | 矩阵的痕迹

python矩阵中插入矩阵The sum of diagonal elements of a matrix is commonly known as the trace of the matrix. It is mainly used in eigenvalues and other matrix applications. In this article, we are going to find the trace of a matrix using inbuilt function nu…

TOP命令监视系统任务及掩码umask的作用

top 命令使用方法及參数。 top 选择參数 參数&#xff1a; -b 以批量模式执行。但不能接受命令行输入&#xff1b;-c 显示命令行&#xff0c;而不不过命令名。-d N 显示两次刷新时间的间隔&#xff0c;比方 -d 5&#xff0c;表示两次刷新间隔为5秒&#xff1b;-i 禁止显示空暇…

python点线图_Python | 点线图

python点线图A mixture of dot and line plot is called a Dot-Line plot. Each dot is connected through a line and it is the next version of the line plot. It maintains the discrete property of the points and also represents the correlation between consecutive…

Android Studio导入工程的正确姿势

为什么80%的码农都做不了架构师&#xff1f;>>> 如果你有很好的网络环境 好的网络环境&#xff0c;这里不是指&#xff1a;我家网速带宽100M&#xff0c;电信的光纤接入。 而是&#xff1a;能翻墙。因为如果本机的gradle和将要导入的工程版本不匹配&#xff0c;Stu…

BBIAF的完整形式是什么?

BBIAF&#xff1a;回来几场 (BBIAF: Be Back In A Few) BBIAF is an abbreviation of "Be Back In A Few". BBIAF是“几回去”的缩写 。 It is an expression, which is commonly used in messaging or chatting on social media networking sites like Facebook, …

为什么年轻人挣得很多还是穷?北上广深挑战指数报告~

又是年底&#xff0c;又到了做选择的时候。从“激情燃烧的岁月”到“何处安放的青春”&#xff0c;逃离北上广深的口号从未停止过&#xff0c;回到北上广深的呼喊更是一浪接着一浪。应届生们奔波忙碌&#xff0c;想有一份承载自己梦想的工作&#xff0c;想在异乡有一处安身之所…

apple组织名称是什么_什么是Apple Macintosh?

apple组织名称是什么苹果Macintosh (Apple Macintosh) Steve Jobs and Steve Wozniak has founded the line of computers in the year 1984, on the date 24th January, named it Apple Macintosh. Macintosh is shortly abbreviated as Mac. In this, various versions of co…

什么是Apple Desktop Bus? 亚行代表什么?

亚行&#xff1a;Apple桌面总线 (ADB: Apple Desktop Bus) ADB is an abbreviation of "Apple Desktop Bus". ADB是“ Apple Desktop Bus”的缩写 。 It is a low-speed proprietary bit-serial peripheral bus connecting devices to computers. In 1986, it was l…

CentOS 创建SVN 服务器,并且自动同步到WEB 目录

CentOS 创建SVN 服务器&#xff0c;并且自动同步到WEB 目录 标签&#xff1a; centossvnsubversion服务器2013-12-06 10:09 5492人阅读 评论(0) 收藏 举报分类&#xff1a;linux&#xff08;5&#xff09; 一、安装Subversion #yum install subversion二&#xff0c;基本的SVN服…