【问题标题】:Which option will auto increase/decrease the height of table in a div哪个选项会自动增加/减少 div 中表格的高度
【发布时间】:2013-06-13 05:59:45
【问题描述】:

请帮帮我!我网站的菜单与website 中的菜单相似。

在此菜单中:

width: 30%;
margin-left: -25%;
height: 98%;
background:#ffab23;
position: fixed;
top: 1%;
bottom: 1%;
z-index: 1;
border-radius:15px;

包含一个包含一列和多行的表格,每一行中都有一个按钮。

如何让表格随菜单自动增减。

部分菜单:

<div id="menu" align="left" style="direction:rtl; overflow:auto;">
<div style="direction:ltr;">
<table height="100" width="80%" align="left">
    <tr>
    <td>
    <a href="#introducere" class="myButton">1. INTRODUCERE</a>
    </td>
    </tr>...

按钮:

.myButton {
-moz-box-shadow:inset 0px 0px 3px 3px #caefab;
-webkit-box-shadow:inset 0px 0px 3px 3px #caefab;
box-shadow:inset 0px 0px 3px 3px #caefab;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #77d42a), color-stop(1, #5cb811) );
background:-moz-linear-gradient( center top, #77d42a 5%, #5cb811 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a', endColorstr='#5cb811');
background-color:#77d42a;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #268a16;
display:inline-block;
color:#306108;
font-family:calibri;
font-size:15px;
font-weight:bold;
padding:2% 24px;
text-decoration:none;
text-shadow:2px 2px 2px #aade7c;
width:79%;}


.myButton:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #5cb811), color-stop(1, #77d42a) );
background:-moz-linear-gradient( center top, #5cb811 5%, #77d42a 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cb811', endColorstr='#77d42a');
background-color:#5cb811;}


.myButton:active { position:relative; top:1px; }

【问题讨论】:

  • 设置高度为auto..

标签: html css button html-table


【解决方案1】:

如果您想自动增加/减少高度,只需使用height:auto,如果您希望宽度相同,请使用width:auto

看到按钮with text INTRODUCERE,当你输入一个冗长的文字时,它会auto increase

【讨论】:

  • 我设置了这个:style="direction:rtl; overflow:auto;">
    - 用于菜单左侧的滚动条,我停止通缉。如果我将删除此选择,一切都很好。对不起我的英语......
  • 对不起,我没有得到你。你到底想要什么?你能在 jsfiddle 中展示一些例子吗?
猜你喜欢
相关资源
最近更新 更多
热门标签