table td 中漂浮层位置css问题_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 12:09:48
原创
1467人浏览过

<html><head>    <style type="text/css">        .td_myadd        {            vertical-align: bottom;        }    </style>     <script language="javascript" type="text/javascript">         function getSelectedValue(ddl_id, text_id) {             var obj = document.getElementById(ddl_id);             var obj2 = document.getElementById(text_id);             for (var i = 0; i < obj.options.length; i++) {                 if (obj.options[i].selected) {                     // return obj.value;                     if (obj.options[i].value.length > 0)                         obj2.value = obj.value;                 }             }         }    </script></head><body>    <table style="border:1px solid # 000;">        <tr>            <td class="td_myadd" name="tname_dg4" style="display: ">                <textarea name="sbd_repeater1$Repeater1$ctl00$txtbox_dg4|5" rows="2" cols="20" id="Textarea4"                    class="usernameFldinput" onblur="javascript:this.style.backgroundColor= ''" onfocus="javascript:this.style.backgroundColor= '#FFC1C1'"                    onpropertychange="this.style.height=this.scrollHeight + 'px'" oninput="this.style.height=this.scrollHeight + 'px'"                    onkeypress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"                    style="overflow-y: hidden; height: 18px; width: 36px; border-bottom: black 1px solid;                    border-top-style: none; border-right-style: none; border-left-style: none; ime-mode: disabled;"></textarea>            </td>            <td class="td_myadd" name="tname_dg4" style="display: ">                <textarea name="sbd_repeater1$Repeater1$ctl00$txtbox_dg4|5" rows="2" cols="20" id="sbd_repeater1_Repeater1_ctl00_txtbox_dg4|5"                    class="usernameFldinput" onblur="javascript:this.style.backgroundColor= ''" onfocus="javascript:this.style.backgroundColor= '#FFC1C1'"                    onpropertychange="this.style.height=this.scrollHeight + 'px'" oninput="this.style.height=this.scrollHeight + 'px'"                    onkeypress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"                    style="overflow-y: hidden; height: 18px; width: 36px; border-bottom: black 1px solid;                    border-top-style: none; border-right-style: none; border-left-style: none; ime-mode: disabled;"></textarea>            </td>            <td class="td_myadd" name="tname_sl2111" style="display: ">                <div style="margin-bottom: 20px; width: 61px">                    <div style="position: absolute; z-index: 1">                        <select name="sbd_repeater1$Repeater1$ctl00$txtbox_sl2111|5$ddl1" id="sbd_repeater1_Repeater1_ctl00_txtbox_sl2111|5_ddl1"                            onclick="getSelectedValue('sbd_repeater1_Repeater1_ctl00_txtbox_sl2111|5_ddl1','sbd_repeater1_Repeater1_ctl00_txtbox_sl2111|5_tb1')"                            style="border-bottom: black 1px solid; border-top-style: none; border-right-style: none;                            border-left-style: none; width: 61px;">                            <option value=""></option>                            <option value="不含税">不含税</option>                        </select>                    </div>                    <div style="position: absolute; z-index: 2">                        <input name="sbd_repeater1$Repeater1$ctl00$txtbox_sl2111|5$tb1" type="text" id="sbd_repeater1_Repeater1_ctl00_txtbox_sl2111|5_tb1"                            style="width: 46px; border-bottom: black 1px solid; border-top-style: none; border-right-style: none;                            border-left-style: none; width: 46px;" />                    </div>                </div>            </td>            <td class="td_myadd" name="tname_dw" style="display: ">                <div style="margin-bottom: 20px; width: 61px">                    <div style="position: absolute; z-index: 1">                        <select name="sbd_repeater1$Repeater1$ctl00$txtbox_dw|5$ddl1" id="sbd_repeater1_Repeater1_ctl00_txtbox_dw|5_ddl1"                            onclick="getSelectedValue('sbd_repeater1_Repeater1_ctl00_txtbox_dw|5_ddl1','sbd_repeater1_Repeater1_ctl00_txtbox_dw|5_tb1')"                            style="border-bottom: black 1px solid; border-top-style: none; border-right-style: none;                            border-left-style: none; width: 61px;">                            <option value=""></option>                            <option value="PCS">PCS</option>                            <option value="个">个</option>                            <option value="公斤">公斤</option>                            <option value="计">计</option>                            <option value="元">元</option>                        </select>                    </div>                    <div style="position: absolute; z-index: 2">                        <input name="sbd_repeater1$Repeater1$ctl00$txtbox_dw|5$tb1" type="text" id="sbd_repeater1_Repeater1_ctl00_txtbox_dw|5_tb1"                            style="width: 46px; border-bottom: black 1px solid; border-top-style: none; border-right-style: none;                            border-left-style: none; width: 46px;" />                    </div>                </div>            </td>        </tr>                    </table></body></html>
登录后复制


输入框会自动换行,把TD撑大,TD的样式 vertical-align: bottom;
但是右边的 没有居下 

右边的是可输入的下拉框,做了3个层,一个输入框,一个下拉框,
我想TD撑大时那堆东西都居下对齐。有没有用样式可以解决的方案。不用JS。

AI建筑知识问答
AI建筑知识问答

用人工智能ChatGPT帮你解答所有建筑问题

AI建筑知识问答 22
查看详情 AI建筑知识问答

回复讨论(解决方案)

有人能来看看嘛

给td加个 position:relative; 然后给td的子标签加position:absolute; 然后设置该div的bottom属性就可以了...

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号