日期:2014-05-17  浏览次数:20750 次

easy ui 的style属性不支持 百分比设置大小么??
最近在做项目中遇到了一个easy ui 的问题。
easy ui 的style不支持用百分比设置宽度或者高度。

我用了一个easyui-accordion的组件和自定义的一个div,给他们设置相同的style属性。
最重要的属性是width=100%
但是效果不尽人意,这个easyui-accordion组件显示的width特别小,貌似是100px,
我认为是这样:他不支持100%,于是认为100%是100px。

如果这样,那该怎么用百分比来设置这个组件的width呢?

代码如下:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="/hello_easy_ui/jquery-easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/hello_easy_ui/jquery-easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/hello_easy_ui/jquery-easyui/demo/demo.css">
<script type="text/javascript" src="/hello_easy_ui/jquery-easyui/jquery.min.js"></script>
<script type="text/javascript" src="/hello_easy_ui/jquery-easyui/jquery.easyui.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<div class="easyui-accordion" style="width: 100%; height: 100px; border-style: solid; border-width: 1px; border-color: red">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow: auto; padding: 10px;">
<h3 style="color: #0099FF;">Accordion for jQuery</h3>
<p>Accordion is a part of easyui framework for jQuery.</p>
</div>
<div title="Help" data-options="iconCls:'icon-help'" style="padding: 10px;">
<p>The accordion allows you to provide multiple panels and display one at a time.</p>
</div>
</div>
<div style="width: 100%; height: 100px; overflow: hidden; border-style: solid; border-width: 1px; border-color: red">aa</div>
</body>
</html>

代码对应的显示效果截图如下:

------解决方案--------------------
不是有个fit属性吗?