CSS实现高度和宽度自适应
其实用绝对定位也可以实现高度和宽度的自适应,从而出现自适应大小的区域及滚动条。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewMarking.aspx.cs" Inherits="FirsteLite.OMS.Checking.NewMarking" %> <!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" style="height:100%;">
<head runat="server">
<title>网上在线阅卷</title>
<style type="text/css">
*
{
margin:0px;
padding:0px;
border-width:0px;
font-size:12px;
} ul
{
list-style-type:none;
} #toolbar li
{
padding:2px;
text-align:center;
cursor:pointer;
} #toolbar li:hover
{
background:url(images/_down.png) no-repeat center center;
} </style>
<script type="text/javascript">
window.onload = function () {
document.getElementById("testImage").src = "../modelimage/11111111111601041701000301.GIF";
}
</script>
</head>
<body style="height:100%;">
<form id="form1" runat="server" style="width:100%;height:100%;">
<div style="width:100%; height:100%; position:relative;">
<div id="header" style="position:absolute;left:0px;top:0px;height:40px;width:100%;background-color:#2964A0;color:White;vertical-align:middle;">
banner<img alt="logo" src="data:images/lg.png" style="float:right;" />
</div>
<div id="left" style="position:absolute;left:0px;top:40px;bottom:25px;width:35px;background-color:#F3F4F6;border-right:1px solid gray;
vertical-align:top;overflow:hidden;">
<ul id="toolbar">
<li><input type="button" title="评语" style="background-image:url('images/icon1.png');
border:1px solid transparent;background-color:transparent;width:29px;height:20px;cursor:hand;" /></li>
<li><input type="button" title="对号" style="background-image:url('images/icon4.png');
border:1px solid transparent;background-color:transparent;width:29px;height:23px;cursor:hand;" /></li>
<li><input type="button" title="半对" style="background-image:url('images/icon3.png');
border:1px solid transparent;background-color:transparent;width:28px;height:28px;cursor:hand;" /></li>
<li><input type="button" title="错号" style="background-image:url('images/icon2.png');
border:1px solid transparent;background-color:transparent;width:29px;height:23px;cursor:hand;" /></li>
<li><input type="button" title="快捷打分" style="background-image:url('images/icon5.png');
border:1px solid transparent;background-color:transparent;width:29px;height:25px;cursor:hand;" /></li>
<li style="border-top:1px solid gray; height:1px; line-height:1px; margin:5px 0px;padding:0px;"></li>
<li><input type="button" title="优秀试题" style="background-image:url('images/icon6.png');
border:1px solid transparent;background-color:transparent;width:29px;height:24px;cursor:hand;" /></li>
<li><input type="button" title="典型试题" style="background-image:url('images/icon7.png');
border:1px solid transparent;background-color:transparent;width:29px;height:24px;cursor:hand;" /></li>
<li><input type="button" title="异常答卷" style="background-image:url('images/icon8.png');
border:1px solid transparent;background-color:transparent;width:29px;height:24px;cursor:hand;" /></li>
<li><input type="button" title="答错位置" style="background-image:url('images/icon10.png');
border:1px solid transparent;background-color:transparent;width:29px;height:24px;cursor:hand;" /></li>
<li><input type="button" title="参考答卷" style="background-image:url('images/icon9.png');
border:1px solid transparent;background-color:transparent;width:29px;height:24px;cursor:hand;" /></li>
<li style="border-top:1px solid gray; height:1px; line-height:1px; margin:5px 0px;padding:0px;"></li>
<li><input type="button" title="默认大小" style="background-image:url('images/icon15.png');
border:1px solid transparent;background-color:transparent;width:28px;height:21px;cursor:hand;" /></li>
<li><input type="button" title="放大" style="background-image:url('images/icon13.png');
border:1px solid transparent;background-color:transparent;width:28px;height:21px;cursor:hand;" /></li>
<li><input type="button" title="缩小" style="background-image:url('images/icon14.png');
border:1px solid transparent;background-color:transparent;width:28px;height:21px;cursor:hand;" /></li>
<li><input type="button" title="前景色设置" style="background-image:url('images/icon22.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
<li><input type="button" title="背景色设置" style="background-image:url('images/icon21.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
<li style="display:none;"><input type="button" title="右旋转" style="background-image:url('images/icon23.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
<li style="display:none;"><input type="button" title="左旋转" style="background-image:url('images/icon24.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
<li><input type="button" title="等高" style="background-image:url('images/icon25.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
<li><input type="button" title="等宽" style="background-image:url('images/icon26.png');
border:1px solid transparent;background-color:transparent;width:28px;height:25px;cursor:hand;" /></li>
</ul>
</div>
<div id="middle" style="position:absolute;left:36px;top:40px;bottom:25px;right:201px;overflow:scroll;">
<img alt="question" id="testImage" src="" />
</div>
<div id="right" style="position:absolute;top:40px;bottom:25px;right:0px;width:200px;border-left:1px solid gray;overflow:hidden;">
<div>right</div>
</div>
<div id="footer" style="position:absolute;bottom:0px;height:25px;width:100%;background-color:#356BA4;">
<div style="height:25px; line-height:25px; width:100%;color:White;vertical-align:middle;">
<span id="lbl_UserName">用户:测试01[160001]</span> <span id="lbl_Number">
评卷量:119</span> <span id="lbl_ExamNum">考号:********</span>
<span id="lbl_Student">学生:********</span> <span id="lbl_SecretNum">
密号:676966996560</span>
</div>
</div>
</div>
</form>
</body>
</html>
CSS实现高度和宽度自适应的更多相关文章
- 【转】纯 CSS 实现高度与宽度成比例的效果
先来演示页面:Demo; 转的内容: 最近在做一个产品列表页面,布局如右图所示.页面中有若干个 item,其中每个 item 都向左浮动,并包含在自适应浏览器窗口宽度的父元素中. item 元素的 C ...
- 【接上一篇】winform中dataGridView高度和宽度自适应填充完数据的高度和宽度,即dataGridView根据数据自适应大小
上一篇:winform中dataGridView高度自适应填充完数据的高度 winform中dataGridView高度自适应填充完数据的高度,就是dataGridView自身不产生滚动条,自己的高度 ...
- css回顾之左侧宽度自适应布局
目标: <!DOCTYPE html> <meta charset=utf-8> <html> <head> <title>alibaba& ...
- css实现高度或者宽度不固定的div元素垂直左右居中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 纯 CSS 实现高度与宽度成比例的效果
http://zihua.li/2013/12/keep-height-relevant-to-width-using-css/
- 相册 垂直居中; 水平居中. 1)宽度 大于高度, 宽度 100%; 2) 高度 大于 宽度 , 高度100%; getimagesize , list --->line-height , text-align, vertical-align, max-height, max-width
一: 效果: 1) 黑色 部分是 相框. 2) 图片 要实现 水平居中, 垂直居中 3) 如果 宽度 大于 高度 ,那么 宽度 100% ,如图1 , 高度 自适应 ,同时不能超过黑色相框的 高度 ; ...
- CSS学习笔记(6)--浮动,三列布局,高度宽度自适应
百度ife任务三,要求中间宽度自适应,高度取三列最高者. 开始用position的relative和absolute,但是relative不能自适应宽,absolute不能加float浮动,撑不起来外 ...
- 【笔记】css 实现宽度自适应屏幕 高度自适应宽度
如果说宽高自适应屏幕尺寸那么大家可能会想到 div{ width: 100%; height: 100% } 但是如果我要自适应屏幕尺寸的同时还要变成正方形呢?(高度和宽度相等而高度不能写死) 那就要 ...
- 不使用border-radius,实现一个可复用的高度和宽度都自适应的圆角矩形
现在css3支持圆角矩形,但是为了兼容性问题,虽然比较麻烦,但还是有必要了解一下以下方法. 在一个div内,包含8个div,控制这个8个div的height.margin以及border属性值,以达到 ...
随机推荐
- c++虚函数和内联构造函数
创建一个含有虚函数的对象时, 编译器会实现 "初始化其VPTR以指向相应的VTABLE" 这个操作 ,而实现这个操作是通过 "插入隐藏代码至构造函数中" 故此时 ...
- LED BIN code
在LED选型时,一开始我们都知道要选个某种颜色,在选个尺寸,但在到具体选的时候,就会被那些个各种各样的参数搞得迷糊,这个主要对一个最让人困惑的参数-BIN CODE做整理. BIN就是bining的缩 ...
- C#多线程开发中如何更新UI界面控件内容
子线程不能修改UI线程的状态(比如文本框里面的内容). 解决的办法是写一个用来更新文本框内容的函数,然后在Worker线程里面通过BeginInvoke来利用delegate调用这个函数更新文本框. ...
- java 调用 sql server存储过程
Transact-SQL中的存储过程,非常类似于Java语言中的方法,它可以重复调用.当存储过程执行一次后,可以将语句缓存中,这样下次执行的时候直接使用缓存中的语句.这样就可以提高存储过程的性能. Ø ...
- 自动化工具selenium
selenium web 自动化工具 selenium 不仅仅可以做web自动化,还可以考虑用于爬虫 java.python..net都可使用,具体使用方法google 构建Python+Seleni ...
- 移动web中一些问题处理与事件说明
1.1.1 所有盒子以边框开始计算 /*设置宽度以边框开始计算*/-webkit-box-sizing: border-box;box-sizing: border-box; 在移动端通常使用的是百分 ...
- 字符数组和string判断是否为空行 NULL和0 namespace变量需要自己进行初始化
string 可以这样判断空行input !="" 字符数组可以通过判断第一个元素是否为空字符'\0',是的话为空行arrar[0]=='\0':或者用长度strlen(char ...
- CSS的重要性
自己很喜欢查看设计出彩的网页,在CSS Zen Garden选择了一个颜色搭配亮眼.结构错落的网页,照着原页面自己写了一个出来.之前做页面的时候总是会把原页面和自己做的放到PS里一个像素一个像素对比查 ...
- LayaAir引擎——(十)
var k = new Array(); var l = new Array(); var m = new Array(); var zhiyeCurosr = 0; function zyinit( ...
- 《HP大规模敏捷开发实践》读书笔记
读这本书的心得,敏捷是实践出来的,哪怕不懂srcum**等方法,只要坚持心中的价值观,朝一个方向改进,哪怕不能“任何时候都拥有符合发布要求的代码”,今天比昨天好,也是成功. 通过业务分析确定开 ...