标签: width

在 SwiftUI 中设置 TextField 的宽度

使用 TextField 时,我想将其设置为固定宽度,而不管显示的文本长度如何,例如“123456789”的字段宽度,即使内容仅为“1”。

TextField("0", text: $username)
    .textFieldStyle(RoundedBorderTextFieldStyle())
    .fixedSize(horizontal: true, vertical: false)
    .frame(width: 120)
Run Code Online (Sandbox Code Playgroud)

我没有找到任何可以设置宽度的东西。使用框架只会影响周围的框架,但我想设置 TextField 本身的宽度。所以可见宽度应该比它的内容宽。任何想法?

width textfield swiftui

3
推荐指数
1
解决办法
5460
查看次数

子控件的宽度应与父容器的宽度匹配

我对WPF很新.我经常发现自己正在努力获得一堆子控件组合宽度以匹配给定的父容器.如下所示:

<ListBox x:Name="BrugereListBox" Grid.Column="0" Grid.Row="3" DataContext="{DynamicResource Brugere}" 
             ItemsSource="{Binding}" 
             PreviewMouseLeftButtonDown="BrugereListBox_MouseLeftButtonDown"
             PreviewMouseMove="BrugereListBox_PreviewMouseMove"
             >
        <ListBox.ItemTemplate  >
            <DataTemplate >
                <Border BorderBrush="Black" BorderThickness="1" Margin="2">
                    <StackPanel Orientation="Vertical" IsEnabled="True" 
                                PreviewMouseLeftButtonDown="StackPanel_PreviewMouseLeftButtonDown">
                        <StackPanel Orientation="Horizontal" >
                            <Label>Navn</Label>
                            <TextBox Text="{Binding Name}"></TextBox>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label>Password</Label>
                            <TextBox Text="{Binding Password}"></TextBox>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label>Email</Label>
                            <TextBox Text="{Binding Email}"></TextBox>
                        </StackPanel>
                    </StackPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我有兴趣获得stackpanel的子节点的宽度:

<StackPanel Orientation="Horizontal" >
                        <Label>Navn</Label>
                        <TextBox Text="{Binding Name}"></TextBox>
                    </StackPanel>
Run Code Online (Sandbox Code Playgroud)

匹配的宽度

<ListBox x:Name="BrugereListBox"
Run Code Online (Sandbox Code Playgroud)

像这样的场景的任何通用解决方案?

wpf controls parent width

2
推荐指数
2
解决办法
2万
查看次数

如何增加HTML表格中列的宽度?

如何增加HTML表格中列的宽度?

以下是我的代码.我试图让<td>每一行中的第二个标记展开,以便输入文本框(第一个<td>标记)与cookie的名称和它的价格(第三个<td>标记)之间有更多的空间.有任何想法吗?

<!--Order Info. table -nested table 2 -->
<!--This is the first nested table within the main table -->
        <table border="0" width="65%" cellpadding="2">
        <!--Row 1 -->
                <tr>
                    <th colspan="3" align="left">Order Information</th>
                </tr>
        <!--Row 2 -->   
                <tr>
                    <td>QTY</td>
                    <td colspan="15"></td>
                    <td>Subtotal</td>
                    <td colspan="90"><input name="Gift Wrapping" id="Gift Wrapping" type="checkbox" /> Gift wrapping? (Additional charge of 1.95 per box)</td>
                </tr>
        <!-- Row 3 -->  
                <tr>
                    <td><input name="quantitya" id="quantitya" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Chocolate …
Run Code Online (Sandbox Code Playgroud)

html html-table cell width

2
推荐指数
2
解决办法
6万
查看次数

HTML滚动条宽度

我想知道HTML中是否有任何滚动条属性来更改HTML中默认滚动条的宽度.

滚动条的默认大小为13px.是否可以增加像素值.

谁能帮忙......

html scrollbar width

2
推荐指数
1
解决办法
1万
查看次数

是否可以在iPad的Safari中覆盖按钮的最小宽度?

我有以下HTML页面:

<html>
<head><style>
  * { margin: 0; padding: 0; border: none; }
  button { width: 14px; background: #F00; }
</style></head>
<body>
  <button></button>
  <button></button>
  <button></button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在任何桌面浏览器中运行此代码时,它都能完美运行;按钮为14像素宽。当我在iPad上的Safari中运行此代码时,按钮变宽了。按键有最小宽度吗?这个宽度可以覆盖吗?

safari button width ipad

2
推荐指数
2
解决办法
1262
查看次数

使用jquery根据td的No设置td的宽度

我有几个网页,不同数量的表具有不同的列数.

我正在网上寻找一个jquery spinet,它获取表的列数,并根据列数定义每列的宽度.

防爆.

  if (noOfTdOnTable == 2) {
     tdWidth = "50%";
    }
    if (noOfTdOnTable == 3) {
      td1Width = "40%";
      td2Width = "40%";
      td3Width = "20%";
    }
    if (noOfTdOnTable == 4) {
      td1Width = "35%";
      td2Width = "25%";
      td3Width = "15%";
      td4Width = "15%";
    }
Run Code Online (Sandbox Code Playgroud)

更新

使用我给出的唯一答案我现在有这个,但只有在页面上有一个表时才有效,当有两列时我无法弄清楚如何应用.

        var num = $("table > td").length;


    if (num % 4 == 0) {
        $("table  > td:eq(0)").css("width", "50%");
        $("table > td:eq(1)").css("width", "30%");
        $("table > td:eq(2)").css("width", "10%");
        $("table > td:eq(3)").css("width", "10%");
    }
    if (num …
Run Code Online (Sandbox Code Playgroud)

jquery html-table width

2
推荐指数
1
解决办法
1万
查看次数

带有溢出的HTML Div宽度:自动?

我正在创建div如下:

编辑:这是一个例子:

<html>
  <body>
    <table>
      <tr>
        <td>
          <div style="position: relative; overflow: auto; max-height: 15em;">
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
            <label><input type="checkbox"/>Hello! Hello!</label><br/>
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

每个标签的文本都不必要地包含在下一行.

我该如何解决?

html css scrollbar width

2
推荐指数
1
解决办法
2万
查看次数

$(element).outerWidth(true)根据主题报告不同?

我有一个jQuery脚本,它通过普通的CSS宽度属性将元素的宽度设置为50%.

如果我然后输出该outerWidth(true)元素以获得精确的像素值,它有时不对应$(window).width()/2- 这是基于该网站的主题.不幸的是,我不能在网上为这种行为带来一个演示.

是否有任何可能导致这种差异的特定CSS属性?

outerWidth()例如,问题是报告564px,但当我检查Safari检查器时,它说580.所以该函数的返回是不正确的,我希望能够知道原因是什么.

演示:

http://users.telenet.be/prullen/this/

http://users.telenet.be/prullen/that/

内容(当您单击红色选项卡时的灰色区域)应该通过负边距隐藏在负载上,但由于(不正确?)返回jquery,它不在其中一个主题中(稍微显示).

console.log调用是:

        console.log('window width / 2 = ' + $(window).width()/2);
        console.log('doc width /2  = ' + $(document).width()/2);

        console.log('width = ' + defaults.boxWidth);
        console.log('width = ' + $slider.css('width'));
        console.log('width = ' + $slider.width());
        console.log('width = ' + $slider.outerWidth());
        console.log('width = ' + $slider.outerWidth(true));
Run Code Online (Sandbox Code Playgroud)

css jquery width

2
推荐指数
1
解决办法
1万
查看次数

html,body和div设置为100%宽度,但仍不能完全使用100%

我将边距和内边距重置为0。余设置的<html><body>宽度为100%。

我的CSS看起来像这样:

html, body { 
    margin:0;
    padding:0;
    width:100%;
}

#wrapper {
    margin:0;
    padding:0;
    width:100%;
    background-color:#ccc;
}
Run Code Online (Sandbox Code Playgroud)

每当我将浏览器的大小调整到可以得到水平滚动条的程度时,div都不会完全占据100%的宽度。甚至没有正文或html。我已经对其进行调试,大约有180px的间隙。

在此处输入图片说明

html css width

2
推荐指数
1
解决办法
6167
查看次数

获取子元素的总宽度

我有一些HTML标签:

<div id="container">
   <input type="text" id="a">
   <textarea id="b"></textarea>
   <div id="c" style="width:200px"></div>
   <div id="d" style="width:20%"></div>
</div> 
Run Code Online (Sandbox Code Playgroud)

#a并且#b没有css width属性.如何计算container像素中子元素的总宽度?

javascript jquery width measure

2
推荐指数
1
解决办法
6065
查看次数

标签 统计

width ×10

html ×4

css ×3

jquery ×3

html-table ×2

scrollbar ×2

button ×1

cell ×1

controls ×1

ipad ×1

javascript ×1

measure ×1

parent ×1

safari ×1

swiftui ×1

textfield ×1

wpf ×1