首页 > 其他分享 >css09 CSS Comments

css09 CSS Comments

时间:2024-05-29 21:59:00浏览次数:13  
标签:code color css09 comments Comments CSS red

https://www.w3schools.com/css/css_comments.asp

CSS comments are not displayed in the browser, but they can help document your source code.


CSS Comments

Comments are used to explain the code, and may help when you edit the source code at a later date.

Comments are ignored by browsers.

A CSS comment is placed inside the <style> element, and starts with /* and ends with */:

Example

/* This is a single-line comment */
p {
  color: red;
}

You can add comments wherever you want in the code:

Example

p {
  color: red;  /* Set text color to red */
}

Even in the middle of a code line:

Example

p {
  color: /*red*/blue; 
}

Comments can also span multiple lines: 

Example

/* This is
a multi-line
comment */

p {
  color: red;
}

   

HTML and CSS Comments

From the HTML tutorial, you learned that you can add comments to your HTML source by using the <!--...--> syntax.

In the following example, we use a combination of HTML and CSS comments:

Example

<!DOCTYPE html>
<html>
<head>
<style>
p {
  color: red; /* Set text color to red */
}
</style>
</head>
<body>

<h2>My Heading</h2>

<!-- These paragraphs will be red -->
<p>Hello World!</p>
<p>This paragraph is styled with CSS.</p>
<p>CSS comments are not shown in the output.</p>

</body>
</html>

 

标签:code,color,css09,comments,Comments,CSS,red
From: https://www.cnblogs.com/emanlee/p/18221143

相关文章

  • css10 CSS Colors
    https://www.w3schools.com/css/css_colors.asp Colorsarespecifiedusingpredefinedcolornames,orRGB,HEX,HSL,RGBA,HSLAvalues.CSSColorNamesInCSS,acolorcanbespecifiedbyusingapredefinedcolorname: <!DOCTYPEhtml><html&g......
  • css07 CSS Attribute Selectors
    https://www.w3schools.com/css/css_attribute_selectors.aspStyleHTMLElementsWithSpecificAttributesItispossibletostyleHTMLelementsthathavespecificattributesorattributevalues.CSS[attribute]SelectorThe[attribute]selectorisusedtos......
  • css08 How To Add CSS
    https://www.w3schools.com/css/css_howto.aspWhenabrowserreadsastylesheet,itwillformattheHTMLdocumentaccordingtotheinformationinthestylesheet.ThreeWaystoInsertCSSTherearethreewaysofinsertingastylesheet:ExternalCSSInte......
  • at-rule or selector expectedcss(css-ruleorselectorexpected)
    问题如图所示,在使用scss和less是使用//注释就会出现红色报错,这个不影响运行,但是看着很不舒服。解决没有找到什么好的解决办法,一般的解决方法是,把验证关闭,然后重启。但是后面我开启这个设置,再进行注释,没有报错,感觉还是重启的作用。先放着不管吧。......
  • 7. CSS 网格布局
    CSS3引入了强大的网格布局(GridLayout),它提供了一种二维的布局方式,使得创建复杂的网页布局变得更加简单和直观。通过定义行和列,我们可以精确控制网页元素的排列和对齐。本章将详细介绍网格布局的基本概念和属性,并通过具体示例帮助读者掌握如何使用网格布局。7.1网格布局简......
  • css06 CSS Pseudo-elements
    https://www.w3schools.com/css/css_pseudo_elements.aspWhatarePseudo-Elements?ACSSpseudo-elementisusedtostylespecifiedpartsofanelement.Forexample,itcanbeusedto:Stylethefirstletter,orline,ofanelementInsertcontentbefore,or......
  • 8. CSS弹性布局基础
    第8章弹性布局基础CSS3引入了一个强大的布局模块——弹性布局(Flexbox),它提供了一种更加高效、直观的方式来排列和对齐元素,使复杂布局的实现变得更加简单。本章将详细介绍弹性布局的基本概念和属性,并通过具体示例帮助读者掌握如何使用弹性布局。8.1弹性布局简介弹性布局(F......
  • 第三方css动画库
    https://animate.style///安装npminstallanimate.css--save//引入import'animate.css';//使用<h1class="animate__animatedanimate__bounce">Ananimatedelement</h1>//样式名称必须加animate__animated之后    ......
  • vite配置自动引入全局scss变量文件
    全局自动引入scss变量文件当定义了全局的scss变量文件并且而其他很多页面都需要使用的时候,都需要显式的使用@import或者@use引用一遍全局scss文件,很是麻烦。使用以下配置这样能有效避免造成大量重复工作,可以在任何scss文件中任意使用全局变量。定义全局scss变量文件配置vi......
  • CSS3 超实用属性:pointer-events (可穿透图层的鼠标事件)
    1、是什么pointer-events 直译为指针事件,该属性指定在什么情况下某个DOM可以成为鼠标事件的target。简而言之,就是允许/禁止DOM的鼠标事件(click事件、hover事件、mouse事件等鼠标事件)2、具体属性分析用法分析:pointer-events:auto|none|visiblePainted|visibleFill|......