当前位置: 首页 > news >正文

做简历的网站有公司网站的作用

做简历的网站有,公司网站的作用,营销型网站建设微博,门户网站开发框架目录 一、CSS 伪元素 二、::before ::after 介绍 1、::before 2、::after 3、content 常用属性值 三、::before ::after 应用场景 1、设置统一字符 2、通过背景添加图片 3、添加装饰线 4、右侧展开箭头 5、对话框小三角 6、插入icon图标 一、CSS 伪元素 CSS伪元…

目录

一、CSS 伪元素

二、::before  ::after 介绍

1、::before

2、::after

3、content 常用属性值

三、::before  ::after 应用场景

1、设置统一字符

2、通过背景添加图片

3、添加装饰线

4、右侧展开箭头

5、对话框小三角

6、插入icon图标


一、CSS 伪元素

CSS伪元素是指,在CSS 中使用一些特殊的选择器,创建出来的虚拟元素, 并不是实际存在的HTML元素;

  • 用来选择和操作文档中的特定部分,实现一些特殊效果;
  • 伪元素使得在不增加额外HTML标签的情况下,对文档中的内容进行样式化;
  • 伪元素也是一种元素,可以设置html中支持的各种属性,包括元素的布局、定位、宽高、背景等等;

本文主要介绍::before 、::after 这个两个伪元素的相关内容和一些使用场景;

二、::before  ::after 介绍

::before  ::after 伪元素用来给元素前面或者后面插入指定内容;

  • 使用content属性来指定要插入的内容;
  • 必须配合content属性一起使用,content的属性值可以为空;
  • 伪元素的display属性值默认为inline

1、::before

::before选择器用来向指定元素之前插入内容;

(1)语法

元素::before{content: "要插入的内容";/* 其他属性 */
}

(2)示例

给页面所有的p元素前面插入内容;

<style>p::before{content: "使用::before伪元素插入的内容——";/* 其他属性 */}
</style>
<body><div><p>第一个P标签中的内容</p><p>第二个P标签中的内容</p><p>第三个P标签中的内容</p></div>
</body>

2、::after

::after选择器用来向指定元素之后插入内容;

(1)语法

元素::after{content: "要插入的内容";/* 其他属性 */
}

(2)示例

给页面所有的p元素后面插入内容;

<style>p::after{content: "——使用::after伪元素插入的内容";/* 其他属性 */}
</style>
<body><div><p>第一个P标签中的内容</p><p>第二个P标签中的内容</p><p>第三个P标签中的内容</p></div>
</body>

3、content 常用属性值

::before  ::after 必须配合content属性一起使用,以下是content的常用属性值:

序号属性值说明
1string设置文本内容;
2url("url")设置图片等媒体文件的URL链接;
3open-quote设置为前引号;
4close-quote设置为后引号;
5attr(attribute)将元素的 attribute 属性以字符串形式返回;
6counter设定计数器;
7none设置 content 为空值;
8normal在 :before 和 :after 伪类元素中会被视为 none,即也是空值;

(1)设置文本内容

设置content的属性值为string类型,即可给伪元素添加文本;

<style>span::before{content: "使用::before添加的文本前缀——————";}span::after{content: "————使用::after添加的文本后缀";}
</style>
......
<body><span class="box">我是HTML元素中的文本</span>
</body>

(2)设置媒体链接

通过url()属性值,即可导入媒体文件为伪元素的内容;

<style>.container {margin: 100px;}.avatar::after{content: url("D:\\test\\girl.png");display: block;}
</style>
......
<body><div class="container"><div class="avatar">示例图片</div></div>
</body>

注意,这里使用url添加的图片不能设置大小,最好通过背景添加图片;

(3)设置前 || 后引号

通过open-quote或close-quote属性值,即可给设置伪元素的内容为前引号或后引号;

<style>p:nth-child(1)::before{content:open-quote;/* 其他属性 */}p:nth-child(2)::after{content:close-quote;}
</style>
......
<body><div><p>添加前引号</p><p>添加后引号</p></div>
</body>

(4)获取元素属性

通过attr()获取元素的某一个属性值(以字符串的形式返回),并设置为伪元素的内容;

<style>a:after {content: " (" attr(href) ")";}
</style>
......
<body><div><a href="https://www.csdn.net">CSDN</a>点击跳转至CSDN...</div><div><a href="https://www.baidu.com">百度</a>点击跳转至百度...</div>
</body>

(5)设置计数器

<style>div {counter-increment: index;}div:before {content:counter(index);}
</style>
......
<body><div>、、、、、、我是第1个div、、、、、、</div><div>、、、、、、我是第2个div、、、、、、</div><div>、、、、、、我是第3个div、、、、、、</div><div>、、、、、、我是第4个div、、、、、、</div>
</body>

三、::before  ::after 应用场景

虽然 ::before  ::after 这两个伪元素的使用方式非常简单,但若能灵活应用,就能实现一些很不错的CSS效果;

1、设置统一字符

<style>p::before{content: "* ";color: red;font-size: 24px;/* 其他属性 */}p::after{content: ":____________";/* 其他属性 */}
</style>
...
<body><div><p>姓名</p><p>年龄</p><p>出生日期</p><p>居住地址</p></div>
</body>

2、通过背景添加图片

<style>.container{margin: 100px;}.container::after{content: "";display:block;width: 260px;height: 260px;background-image: url("D:\\test\\girl.png");background-position: center;background-size: cover;}
</style>
......
<body><div class="container">通过背景添加图片</div>
</body>

3、添加装饰线

<style>.line{display: flex;align-items: center;margin: 60px;height: 40px;font-size: 18px;}.line::before, .line::after{content: "";width: 300px;border-top: 6px double;margin: 5px;}</style>
......
<body><div class="line">添加装饰线</div>
</body>

4、右侧展开箭头

<style>.container{display: flex;flex-direction: column;align-items: center;justify-content: center;width: 400px;margin: 100px auto;padding: 30px 0;border-radius: 8px;box-shadow: 0 0 4px 1px #acacac;}.setting-item{position: relative;align-items: center;display: flex;width: 300px;height: 40px;margin-bottom: 20px;border-bottom: 1px solid #ccc;}.setting-item::after{position: absolute;right: 0;content: "";width: 8px;height: 8px;border-top: 1px solid #666;border-right: 1px solid #666;transform: rotate(45deg);}</style>
......
<body><div class="container"><div class="setting-item">账号设置</div><div class="setting-item">权限管理</div><div class="setting-item">相关服务</div><div class="setting-item">帮助与反馈</div><div class="setting-item">......</div></div>
</body>

5、对话框小三角

<style>.container {width: 400px;margin: 100px auto;padding: 30px 0;border-radius: 8px;box-shadow: 0 0 4px 1px yellowgreen;}.left-box,.right-box {display: flex;}.right-box {justify-content: end;}span {position: relative;display: flex;align-items: center;background-color: yellowgreen;border-radius: 6px;margin: 4px 14px;padding: 16px;}.left-box span::before, .right-box span::after{position: absolute;content: "";width: 12px;height: 12px;background-color: yellowgreen;transform: rotate(45deg);}.left-box span::before{left: -6px;}.right-box span::after {right: -6px;}
</style>......<body><div class="container"><div class="left-box"><span>Nice to meet you!</span></div><div class="right-box"><span>Nice to meet you, too!</span></div></div>
</body>

6、插入icon图标

<style>.login-box{display: flex;flex-direction: column;align-items: center;justify-content: center;width: 400px;height: 400px;margin: 100px auto;border-radius: 8px;box-shadow: 0 0 4px 1px #acacac;}.title{font-size: 24px;font-weight: 700;margin-bottom: 40px;}.account, .pwd, .login-btn, .forgot-pwd{width: 300px;height: 40px;line-height: 40px;}.account, .pwd{display: flex;align-items: center;border-bottom: 1px solid #ccc;font-size: 14px;color: #888;}.pwd{margin-top: 20px;}.account::before, .pwd::before{content: '';display: inline-block;  width: 24px;height: 24px;background-repeat: no-repeat;background-position: center center;background-size: contain;margin-right: 8px;}.account::before{background-image: url("D:\\test\\user.svg");}.pwd::before {background-image: url("D:\\test\\pwd.svg");}.login-btn{text-align: center;color: #fff;font-size: 16px;font-weight: 700;background: #2687F0;border-radius: 5px;margin-top: 40px;}.forgot-pwd{text-align: right;font-size: 14px;color: #888;margin-top: 20px;}
</style>
......
<body><div class="login-box"><div class="title">XXX 管理系统</div><div class="account">请输入账号</div><div class="pwd">请输入密码</div><div class="login-btn">登 录</div><div class="forgot-pwd">忘记密码</div></div>
</body>

=========================================================================

每天进步一点点~!

一个实用的CSS小技巧~!


文章转载自:
http://pan.gthc.cn
http://visigoth.gthc.cn
http://mizzly.gthc.cn
http://bluntness.gthc.cn
http://confidently.gthc.cn
http://enumeration.gthc.cn
http://xeromorph.gthc.cn
http://delicious.gthc.cn
http://outshout.gthc.cn
http://androgyne.gthc.cn
http://textbox.gthc.cn
http://airfreighter.gthc.cn
http://hoopla.gthc.cn
http://demobitis.gthc.cn
http://indubitability.gthc.cn
http://wage.gthc.cn
http://dean.gthc.cn
http://cyanosis.gthc.cn
http://mangabey.gthc.cn
http://limonitic.gthc.cn
http://determinism.gthc.cn
http://icescape.gthc.cn
http://manway.gthc.cn
http://wrinkle.gthc.cn
http://monogamic.gthc.cn
http://somaplasm.gthc.cn
http://vociferate.gthc.cn
http://dispeople.gthc.cn
http://boxing.gthc.cn
http://sermonology.gthc.cn
http://bivalvular.gthc.cn
http://campcraft.gthc.cn
http://naturalize.gthc.cn
http://coven.gthc.cn
http://mousey.gthc.cn
http://yokelish.gthc.cn
http://virose.gthc.cn
http://homme.gthc.cn
http://gitgo.gthc.cn
http://burglar.gthc.cn
http://maroquin.gthc.cn
http://redolence.gthc.cn
http://allergist.gthc.cn
http://christie.gthc.cn
http://wtls.gthc.cn
http://arizona.gthc.cn
http://osmiridium.gthc.cn
http://kidnapping.gthc.cn
http://intransigency.gthc.cn
http://gaiety.gthc.cn
http://confirmatory.gthc.cn
http://singaradja.gthc.cn
http://portiere.gthc.cn
http://unbiased.gthc.cn
http://anise.gthc.cn
http://jesuit.gthc.cn
http://convexly.gthc.cn
http://lapsed.gthc.cn
http://auding.gthc.cn
http://excitosecretory.gthc.cn
http://acuity.gthc.cn
http://rongalite.gthc.cn
http://addressee.gthc.cn
http://mythologize.gthc.cn
http://voiturette.gthc.cn
http://spurt.gthc.cn
http://rda.gthc.cn
http://stub.gthc.cn
http://anaclisis.gthc.cn
http://barracks.gthc.cn
http://chenab.gthc.cn
http://reck.gthc.cn
http://tonalist.gthc.cn
http://andantino.gthc.cn
http://weir.gthc.cn
http://goldenrod.gthc.cn
http://semicolumn.gthc.cn
http://gayest.gthc.cn
http://kab.gthc.cn
http://lacerated.gthc.cn
http://amyotrophia.gthc.cn
http://mellifluent.gthc.cn
http://bud.gthc.cn
http://estuarial.gthc.cn
http://tropism.gthc.cn
http://daywork.gthc.cn
http://embrown.gthc.cn
http://garlic.gthc.cn
http://procurement.gthc.cn
http://euthermic.gthc.cn
http://recoupment.gthc.cn
http://lilliputian.gthc.cn
http://nonofficeholding.gthc.cn
http://kalium.gthc.cn
http://handblown.gthc.cn
http://snow.gthc.cn
http://reflectivity.gthc.cn
http://graben.gthc.cn
http://biograph.gthc.cn
http://tubiform.gthc.cn
http://www.15wanjia.com/news/76743.html

相关文章:

  • 代做毕业设计网站有哪些产品推广广告
  • 南宁企业网站排名优化关键词搜索爱站网
  • 男男做暧暧视频网站怎么去营销自己的产品
  • 邮轮哪个网站是可以做特价网站搜索排名靠前
  • 什么是纯动态网站免费建站系统哪个好用吗
  • 电子政务与网站建设意义seo学习
  • web网站如何做性能测试体验式营销案例
  • fullpage做的网站百度免费推广有哪些方式
  • 网站布局框架怎么做推广让别人主动加我
  • 杨陵区住房和城乡建设局网站网站搭建模板
  • 域名网站建设方案新闻摘抄
  • 社区网站搭建windows优化大师免费版
  • 做网站用什么电脑配置班级优化大师使用心得
  • 辽宁网站制作cba最新排名
  • 在线制作app下载网络优化是做啥的
  • 广州 网站建设公司网站关键词优化的步骤和过程
  • 高仿卡西欧手表网站百度网站大全首页
  • 手机网站后台怎么进怎么做外链
  • 个人一般注册什么类型的公司网站优化方案
  • 武汉光谷网站建设促销活动推广方法有哪些
  • 中国做外国网购的网站宁波网络优化seo
  • 抖音是b2b还是b2c模式百度自然排名优化
  • 网站开发和企业级开发有什么区别怎么优化一个网站关键词
  • 网站后台维护免费发布广告信息网
  • 新公司网站设计关键词排名优化价格
  • 建设银行安全网站淘宝关键词搜索量查询工具
  • 时代空间网站厦门seo顾问
  • 网站建设yu公众号推广平台
  • 网站开发 flex软文世界平台
  • 东莞门户网站建设方案潍坊seo计费