Twitter引导程序:Dropdownlist和Textbox无法正确对齐(Twitter bootstrap: Dropdownlist and Textbox doesn't align properly)
我有一个带有下拉列表的表格,还有两个文本框供我的用户选择他们的生日。 它们全部都在一个表格单元格中,它们具有相同的高度值。 然而,对于我的生活,我无法弄清楚为什么他们的下拉似乎像文本框旁边的2px浮动。 下面是我的代码和图片。
<tr> <td class="tdLeft" style="padding: 10px; text-align: right">Birthdate:</td> <td class="tdRight" style="text-align: left"> <asp:DropDownList ID="ddlMonth" CssClass="form-control input-lg" placeholder="Month" runat="server" Width="136px" style="display: inline; text-align: center" Height="45px"> <asp:ListItem Value="01">January</asp:ListItem> <asp:ListItem Value="02">February</asp:ListItem> <asp:ListItem Value="03">March</asp:ListItem> <asp:ListItem Value="04">April</asp:ListItem> <asp:ListItem Value="05">May</asp:ListItem> <asp:ListItem Value="06">June</asp:ListItem> <asp:ListItem Value="07">July</asp:ListItem> <asp:ListItem Value="08">August</asp:ListItem> <asp:ListItem Value="09">September</asp:ListItem> <asp:ListItem Value="10">October</asp:ListItem> <asp:ListItem Value="11">November</asp:ListItem> <asp:ListItem Value="12">December</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="tbMem1Day" CssClass="form-control input-lg" placeholder="Day" runat="server" Width="74px" style="display: inline"></asp:TextBox> <asp:TextBox ID="tbMem1Year" CssClass="form-control input-lg" placeholder="Year" runat="server" Width="124px" style="display: inline"></asp:TextBox> </td> </tr>
I have a table with a dropdownlist, and two text boxes for my users to select their birthdays. All three of them are in a table cell, and they have the same height value. However, for the life of me I can't figure out why they dropdown seems to be floating like 2px next to the text boxes. Below is my code and a picture.
<tr> <td class="tdLeft" style="padding: 10px; text-align: right">Birthdate:</td> <td class="tdRight" style="text-align: left"> <asp:DropDownList ID="ddlMonth" CssClass="form-control input-lg" placeholder="Month" runat="server" Width="136px" style="display: inline; text-align: center" Height="45px"> <asp:ListItem Value="01">January</asp:ListItem> <asp:ListItem Value="02">February</asp:ListItem> <asp:ListItem Value="03">March</asp:ListItem> <asp:ListItem Value="04">April</asp:ListItem> <asp:ListItem Value="05">May</asp:ListItem> <asp:ListItem Value="06">June</asp:ListItem> <asp:ListItem Value="07">July</asp:ListItem> <asp:ListItem Value="08">August</asp:ListItem> <asp:ListItem Value="09">September</asp:ListItem> <asp:ListItem Value="10">October</asp:ListItem> <asp:ListItem Value="11">November</asp:ListItem> <asp:ListItem Value="12">December</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="tbMem1Day" CssClass="form-control input-lg" placeholder="Day" runat="server" Width="74px" style="display: inline"></asp:TextBox> <asp:TextBox ID="tbMem1Year" CssClass="form-control input-lg" placeholder="Year" runat="server" Width="124px" style="display: inline"></asp:TextBox> </td> </tr>
原文:https://stackoverflow.com/questions/28265329
最满意答案
这段代码应该有效
tree = [('T', [('A1', ['B1', ('B2', ['D1'])]), ('A2', ['C1', 'C2', ('C3', [('E1', ['F1']), ('E2', ['G1', 'G2'])])])])] def print_node(header, tree): if isinstance(tree,str): return [header+' '+str(tree)] else: head, tail = tree return reduce(lambda a,b:a+b,[print_node(header + ' ' + head,t_element) for t_element in tail]) def print_tree(tree): children = tree[0] print '\n'.join(print_node('',children)) print_tree(tree)
它将结果列表保存在内存中并执行简单的递归。 print_tree只是一个以正确形式输入输入的包装器。 希望能帮助到你 !
This code shall work
tree = [('T', [('A1', ['B1', ('B2', ['D1'])]), ('A2', ['C1', 'C2', ('C3', [('E1', ['F1']), ('E2', ['G1', 'G2'])])])])] def print_node(header, tree): if isinstance(tree,str): return [header+' '+str(tree)] else: head, tail = tree return reduce(lambda a,b:a+b,[print_node(header + ' ' + head,t_element) for t_element in tail]) def print_tree(tree): children = tree[0] print '\n'.join(print_node('',children)) print_tree(tree)
It keeps the list of result in memory and performs a simple recursion. print_tree is only a wrapper to put the input in the right form. Hope it helps !
相关问答
更多-
你可以检查一个变量是一个字符串还是unicode字符串 isinstance(some_object, basestring) 对于字符串和unicode字符串,这将返回True 编辑: 你可以做这样的事情: if isinstance(some_object, basestring): ... elif all(isinstance(item, basestring) for item in some_object): # check iterable for stringness of all ...
-
可以比较元组: >>> (1, 'hello') < (2, 'bye') True 元组被比较类似于字符串:在你找到不相等的对之前成对地考虑元素,然后将具有较小元素的元组视为较小。 因此,您可以简单地获得列表的最小值,并返回具有最低第一个值的元组。 然后你可以看看第二个元素中的字符串: least = min(the_list) print least[1] Tuples can be compared: >>> (1, 'hello') < (2, 'bye') True Tuples are c ...
-
如何“走”这个由列表,元组和字符串组成的树?(How to “walk” this tree consisting of lists, tuples and strings?)[2023-09-19]
这段代码应该有效 tree = [('T', [('A1', ['B1', ('B2', ['D1'])]), ('A2', ['C1', 'C2', ('C3', [('E1', ['F1']), ('E2', ['G1', 'G2'])])])])] def print_node(header, tree): if isinstance(tree,str): return [header+' '+str(tree)] else: head, ... -
使用列表理解和通过'单个项目元组创建方法'创建元组或者在这里查看关于这个的信息。 lst = ['aaa','bbb','ccc'] tpl_lst = [(i,) for i in lst] 产量: [('aaa',), ('bbb',), ('ccc',)] Using list comprehension, and tuple creation via the 'single item tuple creation method' or look here for information abou ...
-
在你写的评论中: 筛选器列表包含30,000个单词,元组列表包含大约134,000个2元组。 in对列表的包含测试中,需要O(N)线性时间,当你这样做134k次时这很慢 。 每次必须迭代所有这些元素以找到匹配项。 鉴于您正在过滤,并非所有这些第一个元素都将出现在30k列表中,因此您执行最多30k * 134k == 40亿次比较。 改为使用集合 : filter_set = set(filter) 设置包含测试是O(1)常数时间; 现在你把你的问题减少到134k测试。 你可以避免支出的一小部分时间是元组分 ...
-
使用python将分隔字符串列表转换为树/嵌套字典(convert a list of delimited strings to a tree/nested dict, using python)[2022-03-18]
ls = ['one.two.three.four', 'one.six.seven.eight', 'five.nine.ten', 'twelve.zero'] tree = {} for item in ls: t = tree for part in item.split('.'): t = t.setdefault(part, {}) 结果: { "twelve": { "zero": {} }, "five": { "nine": { " ... -
你需要使用zip : [a in b for a, b in zip(x, y)] You need to use zip: [a in b for a, b in zip(x, y)]
-
在功能上穿过树(walk through tree functionally)[2024-02-18]
这看起来更有用,恕我直言: (defn depth_walk_tree [tree functor] (concat (list (functor (:value tree))) (if (:left tree) (depth_walk_tree (:left tree) functor)) (if (:right tree) (depth_walk_tree (:right tree) functor)))) 它也保留了原始结果: (depth_walk_tree tre ... -
怎么样的: class Foo: def __init__(self, li): self.l = li def __repr__(self): return 'Foo<{0}>'.format(str(self.l)) def make_Foo(obj): if isinstance(obj, list): return Foo([make_Foo(item) for item in obj]) elif isinstan ...
-
使用嵌套列表理解: lst = [tuple(i+x for x in j) for i in prefix for j in suffix] print(lst) # [('blue dog', 'blue shoes', 'blue bike'), # ('blue tree', 'blue cat', 'blue car'), # ('brown dog', 'brown shoes', 'brown bike'), # ('brown tree', 'brown cat', 'brown ca ...