CSS中如何实现分屏,或者点开一个网页时打开两个网页

html-css022

CSS中如何实现分屏,或者点开一个网页时打开两个网页,第1张

css不行,使用JavaScript的open方法即可

<!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/htmlcharset=utf-8" />

<title>无标题文档</title>

<script type="text/javascript">

function change(){

var sw=window.screen.width

var sh=window.screen.height

window.open('http://www.google.com','newWin1','width='+sw/2+',height='+sh+',screenX=0,screenY=0')

window.open('http://www.baidu.com','newWin2','width='+sw/2+',height='+sh+',screenX='+sw/2+',screenY=0')

}

</script>

</head>

<body>

<a href="###" onclick="change()">ddddd</a>

</body>

</html>

<html>

<head>

<title>CSS简单网页</title>

<style>

#box{width:500pxheight:500pxposition:relativelytop:50%left:50%margin-top:-250pxleft:-250pxbackground:#f00color:#fff}

</style>

</head>

<body>

<div id="box">这是一个简单的水平,垂直居中的盒子</div>

</body>

</html>