Tag: 宽度

如何在Python中获得Linux控制台窗口宽度

有没有在python的方式来以编程方式确定控制台的宽度? 我的意思是适合在一行中没有换行的字符数,而不是窗口的像素宽度。 编辑 寻找一个适用于Linux的解决scheme

jQuery – 当不可见时获取元素的宽度(显示:无)

它看起来像在jQuery中,当一个元素不可见时,width()返回0.有道理,但我需要获取一个表的宽度,以便在显示父级之前设置父级的宽度。 如下所述,父母中有文字,使父母歪斜,看起来很讨厌。 我希望父级只能和表一样宽,并且有文本换行。 <div id="parent"> Text here … Can get very long and skew the parent <table> … </table> Text here too … which is why I want to shrink the parent based on the table </div> CSS: #parent { display: none; } 使用Javascript: var tableWidth = $('#parent').children('table').outerWidth(); if (tableWidth > $('#parent').width()) { $('#parent').width(tableWidth); } […]

如何获得android.widget.ImageView的宽度和高度?

╔══════════════════════════════════════════════╗ ^ ║ ImageView ╔══════════════╗ ║ | ║ ║ ║ ║ | ║ ║ Actual image ║ ║ | ║ ║ ║ ║ |60px height of ImageView ║ ║ ║ ║ | ║ ║ ║ ║ | ║ ╚══════════════╝ ║ | ╚══════════════════════════════════════════════╝ <————————————————> 90px width of ImageView 我有一个默认的高度和宽度的图像视图,图像存储在数据库中,我想根据ImageView的高度宽度缩放图像。 因为我不希望它给出默认值,因为当我改变它的高度和宽度时,我也必须在代码中进行更改。 我想获得ImageView的高度和宽度,但在这两种情况下返回给我0。 int height = ((ImageView) v.findViewById(R.id.img_ItemView)).getHeight(); […]

如何使div来填充剩余的水平空间?

我有2个div:一个在左侧,另一个在我的页面右侧。 在左边的一个有固定的宽度,我想右边的一个来填补剩下的空间。 在右侧的是导航,我想要它来填补右侧的剩余空间: 我的CSS: #search { width: 160px; height: 25px; float: left; background-color: #FFF; } #navigation { width: 780 float: left; /*background-color: url('..http://img.dovov.comtransparent.png') ;*/ background-color: #A53030; } 我的Html: <div id="search"> </div> <?php include("navigation.html"); ?> <div id="left-column"> 预先感谢!

在C获得terminal宽度?

我一直在寻找一种方法来获取我的C程序中的terminal宽度。 我一直在提出的是: #include <sys/ioctl.h> #include <stdio.h> int main (void) { struct ttysize ts; ioctl(0, TIOCGSIZE, &ts); printf ("lines %d\n", ts.ts_lines); printf ("columns %d\n", ts.ts_cols); } 但每次我尝试我得到 austin@:~$ gcc test.c -o test test.c: In function 'main': test.c:6: error: storage size of 'ts' isn't known test.c:7: error: 'TIOCGSIZE' undeclared (first use in this function) test.c:7: error: (Each […]

使用CSS时canvas拉伸,但使用“宽度”/“高度”属性正常

我有2个canvas,一个使用HTML属性的width和height来设置它的尺寸,另一个使用CSS: <canvas id="compteur1" width="300" height="300" onmousedown="compteurClick(this.id);"></canvas> <canvas id="compteur2" style="width: 300px; height: 300px;" onmousedown="compteurClick(this.id);"></canvas> Compteur1显示它应该,但不compteur2。 内容在300×300的canvas上使用JavaScript绘制。 为什么有显示差异?

如何使div不超过其内容?

我有一个布局类似于: <div> <table> </table> </div> 我希望div只能扩展到和我的table一样宽。

CSS – 为什么没有百分比高度工作?

为什么height的百分比值不起作用,而width的百分比值呢? 例如 : <div id="working"></div> <div id="not-working"></div> #working{ width:80%; height:140px; background:orange; } #not-working{ width:80%; height:30%; background:green; } #工作的宽度最终为视口的80%,但#not-working的高度最终为0。