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

重庆网站优化网络服务十大看免费行情的软件下载

重庆网站优化网络服务,十大看免费行情的软件下载,建设网站应该加什么服务器,wordpress qq微博文章目录 1&#xff1a;禁止文字被复制粘贴1.1 Css 处理1.2 Js 处理 2&#xff1a;元素垂直水平居中2.1:方案一2.2 方案二2.3 方案三2.4 方案四2.5 方案五 1&#xff1a;禁止文字被复制粘贴 1.1 Css 处理 <div class"text">我不可以复制信息</div> <…

文章目录

    • 1:禁止文字被复制粘贴
      • 1.1 Css 处理
      • 1.2 Js 处理
    • 2:元素垂直水平居中
      • 2.1:方案一
      • 2.2 方案二
      • 2.3 方案三
      • 2.4 方案四
      • 2.5 方案五

1:禁止文字被复制粘贴

1.1 Css 处理

<div class="text">我不可以复制信息</div>
<div>我可以复制
</div>
<style>.text {-webkit-user-select: none;}
</style>

1.2 Js 处理

<script><!-- 禁止右键 -->document.oncontextmenu = () => false<!-- 禁止文字选择 -->	document.onselectstart = () => false
</script>

2:元素垂直水平居中

2.1:方案一

使用弹性布局,父元素设置display: flex另外再设置属性:水平布局justify-content: center;和垂直布局 align-items: center;

<div class="ha"><div class="child"></div></div>
<style>.ha {display: flex;justify-content: center;align-items: center;width: 200px;height: 200px;background-color: #000;}.child {width: 80px;height: 80px;background-color: blue;}  
</style>

2.2 方案二

position: absolute; 位移属性

使用position: absolute; 属性各百分之五十,top: 50%;left: 50%;然后margin减去元素的一半(在已知宽高情况下);

<div class="ha"><div class="child"></div></div>
<style>	.ha {width: 600px;height: 600px;background-color: grey;position: relative;}.child {position: absolute;top: 50%;left: 50%;margin-top: -100px;margin-left: -100px;width: 200px;height: 200px;background-color: #000;}
</style>

2.3 方案三

使用calc()函数进行计算,这个方法和上面方案二类似

<div class="ha"><div class="child"></div></div>
<style>.ha {width: 600px;height: 600px;background-color: grey;position: relative;}.child {position: absolute;top: calc(50% - 100px);left: calc(50% - 100px);width: 200px;height: 200px;background-color: blue;}
</style>

2.4 方案四

使用 平移属性 transform: translate(x轴,y轴)进行位移,各减去元素宽高的一半

margin 和 calc() 函数是在已知元素宽高的情况下进行的处理,在不知道元素宽高的情况下,可以使用transform平移属性进行处理

.child {position: absolute;top: 50%;left: 50%;// transform: translate(-100px, -100px);  //已知元素宽高transform: translate(-50%, -50%);  // 元素比例width: 200px;height: 200px;background-color: blue;
}

2.5 方案五

使用网格布局 父元素声明 display: grid; 子元素使用 align-self: center; justify-self: center;

<div class="ha"><div class="child"></div></div>
<style>.ha {width: 600px;height: 600px;background-color: grey;display: grid;}.child {align-self: center;// margin: 0 auto;   // 让元素水平居中justify-self: center;  // 网格布局的属性width: 200px;height: 200px;background-color: blue;}
</style>

只在父元素上添加属性

display: grid; align-items: center; justify-content: center;

.ha {width: 600px;height: 600px;background-color: grey;display: grid;align-items: center;justify-content: center;
}
.child {width: 200px;height: 200px;background-color: blue;
}
http://www.hotlads.com/news/6258.html

相关文章:

  • 网站建设 b2b网站建设方案及报价
  • 咋把网站制作成软件seo关键词教程
  • 网站开发难度和小程序开发难度软件开发培训学校
  • 电脑本地网站建设深圳搜索引擎
  • 有可以免费建网站的吗知乎推广优化
  • 云建造网站趣丁号友情链接
  • 网址导航系统aso优化
  • wordpress返回件谷歌seo
  • 成都建设官方网站互联网营销有哪些方式
  • 做网站学什么什么专业优化大师怎么提交作业
  • 怎么做动漫网站萧山区seo关键词排名
  • 网站 开发流程方象科技专注于什么领域
  • 聊城市公司网站建站网站制作多少钱
  • 国外专门做视频翻译网站百度收录什么意思
  • 做好政府网站建设工作seo网站优化案例
  • 个人做房产网站莆田seo
  • 做网站和做网页有啥区别百度推广怎么收费标准
  • 中英文企业网站制作网络建站平台
  • 网站备案服务内容企业seo网站营销推广
  • 集团网站建设哪家好小程序seo推广技巧
  • 重庆承越网站建设公司企业网络营销推广方案策划范文
  • 网站怎么做微信分享电脑培训学校哪家好
  • 国内oa办公系统排名搜索引擎优化的方式有哪些
  • 360建筑网挂行情长沙网站seo收费
  • 哈尔滨专业做网站seo提高网站排名
  • 用java做网站验证码怎么写全媒体运营师报考官网在哪里
  • 如何看网站是不是织梦做的网络营销策划书3000字
  • wordpress收录查询一站传媒seo优化
  • 网站的ftp怎么登陆今日足球赛事分析推荐
  • 建设网站费用明细站长之家官网