CSS样式链接和文字常用属性

行内: <div style="color:red;"></div>

内嵌<style>div{background-color:red;}</style>

外部引用

<link rel="stylesheet"(样式表) href="./xxx.css">

xxx.css文件:  div{color:red}

CSS文字属性

color : #999999; /*文字颜色*/

font-family : 宋体,sans-serif; /*文字字体*/

font-size : 9pt; /*文字大小*/

font-style:itelic; /*文字斜体*/

font-variant:small-caps; /*小字体*/

letter-spacing : 1pt; /*字间距离*/

line-height : 200%; /*设置行高*/

font-weight:bold; /*文字粗体*/

vertical-align:sub; /*下标字*/

vertical-align:super; /*上标字*/

text-decoration:line-through; /*加删除线*/

text-decoration: overline; /*加顶线*/

text-decoration:underline; /*加下划线*/

text-decoration:none; /*无修饰线*/

text-transform : capitalize; /*首字大写*/

text-transform : uppercase; /*英文大写*/

text-transform : lowercase; /*英文小写*/

text-align:right; /*文字右对齐*/

text-align:left; /*文字左对齐*/

text-align:center; /*内部元素居中*/

text-align:justify; /*文字分散对齐*/

vertical-align:top; /*垂直对齐该行元素内的最大元素顶部/

vertical-align:bottom; /*垂直对齐该行元素内的最大元素的底部*/

vertical-align:middle; /*垂直居中对齐*/

vertical-align:text-top; /*垂直对齐父元素的顶部*/

vertical-align:text-bottom; /*垂直对齐父元素的底部*/

top、bottom、text-top、text-bottom区别:

<p style="font-size: 15px; text-decoration: overline ;">一个

<top>top对齐</top>

<span style="font-size: 30px; text-decoration: overline;">方式</span>

</p>

<p style="font-size: 15px; text-decoration: overline ;">一个

<ttop>text-top对齐</ttop>

<span style="font-size: 30px; text-decoration: overline;">方式</span>

</p>

<p style="font-size: 15px; text-decoration: overline ;">一个

<bottom>bottom对齐</bottom>

<span style="font-size: 30px; text-decoration: overline;">方式</span>

</p>

<p style="font-size: 15px; text-decoration: overline ;">一个

<tbottom>text-bottom对齐</tbottom>

<span style="font-size: 30px; text-decoration: overline;">方式</span>

</p>

运行结果:

overflow:hidden;//隐藏文本溢出部分。

white-space:nowrap;//对文本不换行。

text-overflow:ellipsis;//溢出部分用省略表示(基于前两个属性都有的情况下)

text-overflow:clip;//剪切。

text-overflow:".....";//自定义格式。

position:absolute;//设置文档的位置为绝对定位,relative表示相对定位。

right:50px;//表示该元素距离右边元素的距离为50px,使用该元素必需设置position元素。

z-index;/*指定元素的堆叠顺序*/

clip:rect(top,right,bottom,left);/*剪切图形*/

flex//flex布局,在使用flex布局的时候,需要将父容器的flex的display设置为“display:flex;”。

title:"提示信息“   title元素用在指定的元素上,会出现提示信息。

原文地址:https://www.cnblogs.com/mengmengi/p/10137056.html

时间: 2024-10-03 10:04:06

CSS样式链接和文字常用属性的相关文章

论CSS样式的使用以及常用属性

css的使用方式() 1.行内样式(内联样式) <标签 ></标签> 2.页面嵌入(内部样式表) 在head标签里面增加一个子标签 <style> 选择器{ 属性名1:属性值1; 属性名2:属性值2; ...... } </style> 3.外部文件(外部样式表) 在head标签里面增加一个子标签 <link rel="stylesheet" href="css文件的路径" /> 4.外部导入样式 主要用在

css样式表中四种属性选择器

css样式表中四种属性选择器1> 简易属性 tag[class]{ font-weight:bold } It will affect all tag with any class. e.g. <h2 class="old" > or <h2 class="new"> 2>精确属性值 a[href="http://www.cnblogs.cn"][title="textTitle"]{fon

表单、框架结构的大概、CSS开头(选择器以及常用属性)

<!--为网页添加图标,写在头部--> <link rel="shortcut icon" href="favicon.ico(路径)" type="image/x-icon"> 表单fieldset legend定义表单元素的标题 from(供用户输入的表单) <from action="后台名" method="post/get" enctype="multipa

CSS样式-链接

能够设置链接样式的CSS属性有很多.链接的特殊性在于能够根据他们所处的状态来设置它们的样式.链接的四种状态: a:link 普通的,未被访问的链接 a:visited 用户已访问的链接 a:hover  鼠标指针位于链接的上方 a:active  链接被点击的时刻 当为链接的不同状态设置样式时,请按照以下次序规则: a:hover 必须位于 a:link 和 a:visited 之后 a:active 必须位于 a:hover 之后 常见的链接属性: color属性规定链接显示的颜色 text-

css样式清零及常用类

@charset "utf-8"; /*CSS Reset*/ /*"微软雅黑","\5FAE\8F6F\96C5\9ED1","Microsoft YaHei" "黑体","\9ED1\4F53" "新宋体","\65B0\5B8B\4F53" "宋体","\5B8B\4F53" "幼圆"

web前端入门到实战:html/css弹性布局的几大常用属性详解

弹性布局的名称概念: 1.容器:需要添加弹性布局的父元素:项目:弹性布局容器中的每一个子元素,称为项目. 2.主轴:在弹性布局中,我们会通过属性规定水平/垂直方向(flex-direction)为主轴:与主轴垂直的另一方向,称为交叉轴. 弹性布局的重要的几大基础属性: 1.flex-direction属性决定主轴的方向(即项目的排列方向). row(默认值): 主轴为水平方向,起点在左端: row-reverse: 主轴在水平方向,起点在右端 : column:主轴为垂直方向,起点在上沿. co

CSS样式进阶之文字的排版

文字排版 为文字设置字体 body{font-family:"宋体";} 设置字号,颜色 body{color:red;font-size:12px} 设置粗体 p{font-weight:bold;} 斜体 p{font-style:italic;} 下划线 p{text-decoration:underline;} 删除线 p{text-decoration:line-through;} 段落缩进 p{text-indent:2em;}/*缩进单位为文字的两倍大小.*/ 设置行间距

第一周复习二 (CSS样式表及其属性)

样式表三种写法 1内联写法:style直接写在标签内.个人感觉多用于个别标签,一般情况优先级较高 style="font-size:16px;" 2内嵌写法:写在<head></head>标签内.个人感觉多用于较多或通用的一类标签,用来减少工作量 <style type="text/css"> {} </style> 分为三种: 标签选择器 <style type="text/css">

对于用js获取元素的css样式属性(getComputedStyle,currentStyle,style)(getPropertyValue,getAttribute)

首先单独拎出来讲的是style style: nodeObject.style.cssProperty获取的是DOM节点上 style 属性定义的样式,如果不存在 style 属性,或者 style 属性没有定义相应的样式,则是无法获取的.也就是说,JavaScript 不会到 <style> 标签或者 CSS 文件去获取相应的样式,只能获取 style 属性定义的样式. 就是外部样式表,内部样式表,用style都是无效的,只有内联样式是有效的,当然用style写入也是写入在内联样式的. 然后