在HTML里如何使用css(标签有哪些属性)

内部样式表

css写在head头部标签当中,如:

<head>
	<meta charset="utf-8">
		<title></title>
		<style type="text/css"><!-- 一般写在title下面 -->
			
		</style>
</head>

行内式

css写在标签名后面,<标签名 空格 style="属性; 属性; 属性; ">内容</标签名>,如:

	<div style="">
		 内容
	</div>

外联式

用link标签来连接外部的css,如

<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="" /> <!-- href为css的路径 -->
</head>

表单

表单的属性有
action=提交的地址
method=提交方式
post get为method的值

		<form action="" method="post">
			<input type="text" name="" id="" value="" />
			<input type="password" name="" id="" value="" />
			<input type="submit" value="提交"/>
		</form>

颜色(背景颜色)

color可也把里面的内容变色
color属性值可以直接写预定值:red、blue、pink等等,如:

<div style="color: red;">
			颜色变红
</div>

还可以写
十六进制:用#来写,如:

<div style="#000000;"><!-- 可以简写#000 -->
			颜色变黑
</div>

rgb(a):如:

<div style="rgb(255,255,255,0.5);"><!-- a是透明度 a前面的0可以不写.5浏览器自动会加 -->
			颜色变白
</div>

background-color 背景颜色
background-image 图片
background-repeat 是否平铺
background-attachment 背景图像是否固定或者随着页面的其余部分滚动。
background-position 图片位置

表格

action=提交的地址
method=提交方式
post get为method的值

<form action="" method="post">
			<input type="text" name="" id="" value="" />
			<input type="password" name="" id="" value="" />
			<input type="submit" value="提交"/>
	</form>

a标签

none 默认 定义标准文本
overline 定义文本上的一条线
line-through 定义穿过文本的一条线
underline 定义文本下的一条线

<a href="" style="text-decoration: none;">
		 111111111
</a>

文本效果

text-transform:uppercase;转大写
text-transform:lowercase;转小写
text-transform:capitalize;默认值
text-indent:50px 首行缩进

		<div style="text-indent: 50px;">
			Hello Word Jack
		</div>

font-style 字体倾斜
font-size 字体大小
font-family 字体样式,微软雅黑
font-weight 字体粗细
其他可以省略不写(为默认值)但是font-sizifont-family必须写(综合写法)

<p style="font:font-style:normal ;font-weight:normal ;font-sizi:16px ; font-family: 宋体;">宋体</p>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值