蛙蛙推荐:css背景图片固定居中,div阴影,背景半透明,div圆角,DIV渐变_html/css_WEB-ITnose
很久不更新博客,整理了CSS的一些常用效果,尽量兼容多的浏览器,包括背景图片固定居中,div阴影,背景半透明,div圆角,DIV渐变等。
<p class="sycode"> < html > < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" /> < title > CSS test </ title > < style type ="text/css" > body { margin : 0 ; /* 背景图片固定居中 http://www.w3school.com.cn/css/pr_background-position.asp http://www.198484.com/?action=show&id=51 */ background-image : url('images/bg1.jpg') ; background-attachment : fixed ; background-position : center ; background-repeat : no-repeat ; } #header { } #inner-header { margin : 0 auto ; width : 960px ; background-color : Gray ; height : 80px ; /* 布局块阴影,如果不想支持低版本IE可去掉滤镜 http://blog.imbolo.com/cross-browsers-css-shadow/ */ box-shadow : 3px 3px 4px #000 ; -moz-box-shadow : 3px 3px 4px #000 ; -webkit-box-shadow : 3px 3px 4px #000 ; filter : progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000') ; -ms-filter : "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')" ; } #main { background-color : Gray ; margin : 10 auto ; width : 960px ; min-height : 500px ; height : auto ; /* 背景半透明 http://blog.csdn.net/zenwong/archive/2008/08/29/2846546.aspx */ filter : alpha(opacity=70) ; /* IE */ -moz-opacity : 0.7 ; /* Mozilla */ opacity : 0.7 ; /* FF */ /* 圆角效果,不考虑低版本IE http://blog.imbolo.com/creating-rounded-corners-with-css/ */ -moz-border-radius : 20px ; -webkit-border-radius : 20px ; border-radius : 20px ; } #footer { margin : 0 auto ; width : 960px ; height : 100px ; /* 渐变效果 http://www.zhangxinxu.com/wordpress/?p=743 */ filter : alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0) ; -ms-filter : alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0) ; /* IE8 */ background-color : Gray ; /* 一些不支持背景渐变的浏览器 */ background : -moz-linear-gradient(top, red, rgba(0, 0, 255, 0.5)) ; background : -webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0.5))) ; background : -o-linear-gradient(top, red, rgba(0, 0, 255, 0.5)) ; } </ style > <!-- [if IE]> <style type="text/css"> #main { height: 500px; } body { text-align:center; } #inner-header { text-align:left; } </style> <![endif] --> </ head > < body > < div id ="header" > < div id ="inner-header" > < h1 > CSS Demo </ h1 > </ div > </ div > < div id ="main" > </ div > < div id ="footer" > </ div > </ body > </ html > </p>

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。

HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

网页批注功能的Y轴位置自适应算法本文将探讨如何实现类似Word文档的批注功能,特别是如何处理批注之间的间�...

GiteePages静态网站部署失败:404错误排查与解决在使用Gitee...

实现图片点击后周围图片散开并放大效果许多网页设计中,需要实现一种交互效果:点击某张图片,使其周围的...

HTML、CSS和JavaScript是Web开发的三大支柱。1.HTML定义网页结构,使用标签如、等。2.CSS控制网页样式,使用选择器和属性如color、font-size等。3.JavaScript实现动态效果和交互,通过事件监听和DOM操作。
