<分区>
我是网页设计的新手。什么是用于创建简单分屏布局的 HTML 和 CSS?
最佳答案
在我看来,最好的方法是,假设您的意思是一个包含两列的页面应该有两个像这样的 div:
<html>
<head>
<style>
#header {width: 100%; height: 100px; background-color: red;}
#col-1 {width: 50%; float: left; height: 400px; background-color: green;}
#col-2 {width: 50%; float: right; height: 400px; background-color: blue;}
/* Height can be changed but width cannot */
</style>
</head>
<body>
<div id="header"><h1>This is a header</h1></div>
<div id="col-1"><h1>This is half of a page</h1></div>
<div id="col-2"><h1>This is another half of a page</h1></div>
</body>
</html>
这是一个代码笔: http://codepen.io/anon/pen/zqvyYp?editors=1000
*因为这使用宽度的百分比,所以这将是响应式的
关于html - 使用 HTML 和 CSS 的响应式分屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35817248/