【发布时间】:2014-04-12 17:01:35
【问题描述】:
我开始学习 HTML 并开始接触 CSS。
我正在尝试将 a 从黑色变为绿色(非常简单)。 现在,由于这是为了我自己的学习,我正在添加我自己的 cmets 以供参考。
我注意到如果我保留评论,CSS 将不起作用,文本会保持黑色,但是当我删除评论时,CSS 工作?
谁能解释一下为什么会这样?
这是我的代码
<html xmlns="http://w3.org/1999/xhtml">
<head>
<title>Homepage</title>
<meta http-equiv="Content-type" content="text.html; charset=UTF-8"/>
<meta name="keywords" content="CCS, in-line, internal, external, style sheets"/>
<meta name="description" content="CSS internal, external and in-line"/>
<meta name="author" name = "Jordan Atkinson" />
<!-- internal CSS, this is to be put after the meta tags and will be inside a tag called <style type="text/css>
This is the tag that is used so that CSS can recognise its start point, imagine it as the public static void main(String[] args) in Java-->
<style type="text/css">
<!-- Typing h1 (known as a 'selector' selects the element in the body you want to apply the CSS, the braces is where you put the attributes and values to
style an element. H1 can be any tag within the body, so you could type table if you wish to apply styles to tables. Color (american spelling):green
changes the color to that specified after the colon. after the green, you MUST always end with a semi colon.-->
h1 {color:green;}
</style>
</head>
<body>
<h1>Homepage</h1>
</body>
</html>
导致问题的评论是这样的:
<!-- Typing h1 (known as a 'selector' selects the element in the body you want to apply the CSS, the braces is where you put the attributes and values to
style an element. H1 can be any tag within the body, so you could type table if you wish to apply styles to tables. Color (american spelling):green
changes the color to that specified after the colon. after the green, you MUST always end with a semi colon.-->
任何帮助将不胜感激。
问候
约旦。
【问题讨论】:
标签: html css tags comments stylesheet