Html 在CSS的同一元素上使用多个类和子类的最佳方法

Html 在CSS的同一元素上使用多个类和子类的最佳方法,html,css,Html,Css,如何对同一元素使用三个不同的类?它们中的两个共享同一父类重要吗?我有一个typeform链接,它使用了一些功能,所以它有一个typeform类。但我也希望它是.button.white和/或.button.transparent 我目前正在尝试以下方法: <a class="typeform-share button white button transparent"> <a class="typeform-share" class="button white" class="

如何对同一元素使用三个不同的类?它们中的两个共享同一父类重要吗?我有一个typeform链接,它使用了一些功能,所以它有一个typeform类。但我也希望它是.button.white和/或.button.transparent

我目前正在尝试以下方法:

<a class="typeform-share button white button transparent">
<a class="typeform-share" class="button white" class="button transparent>


html标记的此语法无效:

<a class="typeform-share" class="button white" class="button transparent">

来自CSS技巧,这将使您的生活更轻松。

对于同一个元素使用多个类是没有关系的。但是,请注意,相同的css不会应用于相同的元素。例如:
padding:5px
和第二类
padding:10px
。它将覆盖第一个CSW你说的子类和父类是什么意思
.button.white
.white.button
没有区别-它只是查询属于这两个类的元素。噢!我是CSS新手。我以为是button.白色意味着这个白色是button类的一部分。就像我可以有button.white意味着按钮内的文本是白色的,但是header.white可能意味着标题的背景色是白色的。我误解了cssHow中的类是如何工作的。它知道空间是指子类还是不同的类吗?例如,button.white和typeform共享。。。如果我使用“button white typeform share”,它如何知道它是button.white和typeform share,而不是button.white.typeform share?请检查我提供的链接。那会让你明白一切。
<a class="typeform-share">
<a class="typeform-share button white button transparent">
<!--Remove one of the button class, you don't need to repeat-->