Web Development Foundation study notes finishing (7)

The use CSS

1) Inline style

style = "" written at the beginning tag <div style=””></div>

2) internal style

Syntax: The CSS style written in the <style>tag, <style>is written in the <head>tag.

3) external style

grammar:

  • ① write the CSS styles in a separate file, the file must be in .css file ending;
  • ② in the page <head>markup, and then use the <link>file marks the end of the introduction .css on it.

The CSS selector

(Note: only use internal or external style of writing style, the selector will be used)
Selector: The contents of body modification body style, is searchable by both selectors

  • 1) Selector marker: the search by tag
  • 2) selector id: id lookup based on the value of
  • 3) class class selector: The search according to the value of the class

CSS, add a comment

/* */

Code section:

part1:

<html>
	<head>
		<title>内外部样式举例</title>
		<!-- 内部样式 -->
		<style>
			<!-- 标记选择器写法 -->
			div{
				color:green;
			}
			a{
				color:blue;
				font-size:30px;
			}
		</style>
		<!-- 外部样式 -->
		<link rel="stylesheet" type="text/css" href="mytest.css"/>
	</head>
	<body>
		<!-- 内联样式 -->
		<div style="color:red">今天是星期二</div>
		<div>今天是3月24日</div>
		<a href="http://www.baidu.com">百度一下</a>
		<!-- <p style="color:yellow;font-size:50px">我是一个段落标记</p> -->
		<p>我是一个段落标记</p>
	</body>
</html>
p{
	color:yellow;
	font-size:60px;
}

Renderings:

Here Insert Picture Description

part2:

<html>
	<head>
		<title>CSS的选择器</title>
		<!-- 内部样式 查找标记 -->
		<style>
			/* 1.标记选择器:根据标记的名字进行查找的 */
			a{
				color:red;  /* 修改字体的颜色 */
				font-size:30px;  /* 修改字体的大小 */
				text-decoration:none;  /* none取消下划线 underline加下划线 */
			}
			div{
				text-decoration:underline;
				font-size:30px;
			}
		</style>
	</head>
	<body>
		<a href="http://www.baidu.com">点我去百度</a>
		<br/>
		<a href="http://www.taobao.com">点我去淘宝</a>
		<div>我是div</div>
		<span>我是span</span>
	</body>
</html>

Renderings:

Here Insert Picture Description

Published 80 original articles · won praise 59 · views 4217

Guess you like

Origin blog.csdn.net/qq_44458489/article/details/105068177