页面元素居中 css获取页面中心位置
css获取页面中心位置
.fixed
{
FONT-SIZE: 30pt;
color : #1A6841;
left:expression(eval(document.body.clientWidth)/2-150);
top:expression(eval(document.body.clientHeight)/2-25);
width:300px;
height:50px;
border:green 1px solid;
background:#99CCFF;
+position:absolute;
+left:expression(eval(document.body.scrollLeft)+eval(document.body.clientWidth)/2-150);
+top:expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)/2-25);
}
网页可见区域宽:document.body.clientWidth
网页可见区域高:document.body.clientHeight
网页可见区域宽:document.body.offsetWidth (包括边线的宽)
网页可见区域高:document.body.offsetHeight (包括边线的宽)
网页正文全文宽:document.body.scrollWidth
网页正文全文高:document.body.scrollHeight
网页被卷去的高:document.body.scrollTop
网页被卷去的左:document.body.scrollLeft
网页正文部分上:window.screenTop
网页正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth
通用对联实现,Div在底部浮动
<table width="1003" border="0" cellspacing="0" cellpadding="0" align="center" id="maple1">
<tr>
<td align="center" height="30" bgcolor="#999999">浮动内容哦</td>
</tr>
</table>
<script type="text/javascript" src="Maple_Couplet.Js"></script>
<script type="text/javascript">
window.onload = function(){
n=window.screen.height; //屏幕的分辨率
m=window.screenTop; //网页内容距屏幕顶部的距离 即 IE按钮,地址栏等的高度
myBottom=n-m-30-50; //n-m-显示Div的高-底部状态栏和任务栏的高约50
//aa.innerHTML=m;
new couplet("maple1",myBottom,40);
}
</script>
<SCRIPT language="JavaScript" type="text/javascript">
function openmu() {
//var left = screen.width;
&
相关文档:
什么情况下会出现换行:
当元素设置了固定高度,并且文本长度大于标签元素的宽度时,文本会自动换行。
css强制换行使用样式:white-space:nowrap;该样式从效果上是没有浏览器差异,使用该样式后所有文字在ie和firefox下都在一行内显示。但是在IE下使用该属性值后标签元素宽度会被撑大,从而可能导致原来页面布局被破坏。
......
CSS,层叠样式表的作用是什么?我们先通过一个例子来体会一下:
看代码:
index.html
<!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=" ......
逐渐喜欢上padding 虽然它并不完美,任何事物都有两面性,无所谓对错,关键是要用对地方!
padding 和 margin相比较,padding 可以将div 等撑起来占用实际空间,而margin则比较小心。
但是就是padding这点缺帮我解决了一个input 和 submit的对齐问题。 ......
首先感谢“丸子
”提供的这个
IE8的css hack;
关注过IE8的css hack的人相信大家都在使用这个hack,就是“\9”的css hack:
.test{
color:#000000; /* FF,OP支持 */
color:#0000FF\9;&n ......
适用于只有一行文字的情况.
.ellipsis{
text-overflow:ellipsis; /*当对象内文本溢出时显示省略标记(...)*/
width:200px; height:50px;
overflow:hidden;
white-space:nowrap;
}
text-overflow是CSS3的属性,IE6以上版本、Safari、chrome 支持。它可以带2个参数:
clip [不显示省略标记(...),而是 ......