html - 哪个选项将自动增加/减少 div 中表格的高度

标签 html css button html-table

请帮帮我!我网站的菜单类似于此 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; }

最佳答案

只需使用 height:auto如果你想自动增加/减少高度,如果你想要相同的宽度那么使用 width:auto .

查看按钮 with text INTRODUCERE当您输入冗长的文本时,它将 auto increase .

关于html - 哪个选项将自动增加/减少 div 中表格的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17080171/

相关文章:

javascript - 如何更改不是 "(obj)"的元素的样式

css - 一个看起来像使用 CSS 的按钮的标签

android - 为什么我不能在 GridView 之后添加元素?

android - 如何让按钮在按下时改变颜色?

javascript - 如何制作可编辑的 bootstrap html 表单

HTML:列中的图像

javascript - 在一个简单的 jquery 视差示例中使文本以不同的速度滚动

css - CSS 定位和 CSS 边距之间的区别

jquery - 自动完成下拉列表未正确显示

android - 如果没有像操作栏中那样的空间,如何隐藏按钮