CSS如何显示一个从左上角开始展开的弹窗,最终是显示在屏幕中间,思路是什么,请大神指导下。

html-css010

CSS如何显示一个从左上角开始展开的弹窗,最终是显示在屏幕中间,思路是什么,请大神指导下。,第1张

思路应该是一个从0%到100%的动画展开的效果,大概需要写0%,50%,100%三个样式。 弹窗的css代码大概是:position: fixedz-index: 2000left: 0top: 0这样弹窗的左上角原点在页面最左上角,如果要调整位置要用CSS变换特效(transform)的平移translate函数达到目的: translate(x, y)(长度值或者百分比):在水平方向、垂直方向平移元素。    translateX(value):水平方向平移。    translateY(value):垂直方向平移。    scale(x, y)、scaleX(value)、scaleY(value):在水平方向、垂直方向或者两个方向上缩放元素。    rotate()、rotateX()、rotateY()、rotateZ():rotate支持3D效果,可在x、y、z轴上旋转元素。    skew()、skewX()、skewY():在水平方向、垂直方向或者两个方向倾斜一定的角度。  另外弹窗展开的动画要用到css3的动画属性:    animation-delay:设置动画开始前的延迟时间。    animation-direction:设置动画循环播放的时候是否方向播放,包含normal和alternate两个值。    animation-duration:设置动画播放持续的时间。    animation-interacion-count:设置动画的播放次数,可以为具体数据或者无限循环关键字infinite。    animation-name:指定动画名称。    animation-play-state:允许动画暂停和重新播放,包含running、paused。    animation-timing-function:指定如何计算中间动画值,

让页面在不同分辨率下都全屏显示,完整代码参考如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

<head> 

<meta http-equiv="Content-Type" content="text/html charset=utf-8" /> 

<title>实现两边固定宽度,中间自适应宽度-</title> 

<style> 

body{ margin:0 padding:10px} 

#head{ margin-bottom:10px height:50px background-color:#999999} 

#main{} 

#left{ width:200px float:leftmargin-right:-200px background-color:#FF9900} 

#mid{ width:autobackground:#00FF00margin:0 220pxborder:1px solid #000} 

#right{ width:200pxmargin-left:-200px float:right background-color:#CCCC00} 

#foot{ margin-top:10px clear:both height:50px background-color:#CCCCCC} 

 

</style> 

</head> 

 

<body> 

<div id="head">我是头部</div> 

<div id="main"> 

<div id="left">我是左边,宽:200px</div> 

<div id="right">我是右边,宽:200px</div> 

<div id="mid">我是中间,宽自适应</div> 

</div> 

<div id="foot">我是底部</div> 

</body> 

</html>