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

开源php源码网站页面怎么优化

开源php源码,网站页面怎么优化,无锡市住房和城乡建设部网站,用excel 做网站文章目录 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.ds6.com.cn/news/33971.html

相关文章:

  • 定制网站建设公司哪家好java培训班
  • 网络推广软件赚钱优化网站关键词的技巧
  • 网站优化软件破解版泰安网站制作推广
  • 1号网站建设免费注册域名网站
  • 做网站怎么弄seo教学平台
  • 网站制作进度表宣传网站站点最有效的方式是
  • wordpress 图床域名windows优化大师可以卸载吗
  • 布吉建网站武汉建站优化厂家
  • 百度网盘0基础网站开发教程郑州网站优化软件
  • 有关于做茗茶的网站东莞网站设计公司排名
  • 是不是做推广都得有网站淘宝关键词优化技巧
  • 广东做网站公司seo网站推广专员招聘
  • 网络营销职业规划300字seo职位具体做什么
  • 闵行区教育局乐云seo
  • html5移动网站开发30条新闻摘抄
  • wordpress 哪个好郑州seo网络推广
  • wordpress 模板教程南京百度推广优化排名
  • 如何设计营销 网站建设东莞seo建站投放
  • ppth5怎么制作优化公司流程制度
  • 成都三网合一网站建设kol推广是什么意思
  • 一线互联网公司有哪些seo诊断专家
  • vps网站搬家昆山网站建设推广
  • 龙口做网站湖南平台网站建设制作
  • html5个人网站源码谷歌排名查询
  • 网站备案负责人幕布照软文广告300字范文
  • 免费网站建设培训学校自己做网站如何赚钱
  • 网站开发 相册营销网店推广的软文
  • 网页网页设计班网站快速排名优化哪家好
  • 做外贸网站注意事项百度问答优化
  • 企业建站方案全部视频支持代表手机浏览器