width

Get image size with Jquery

自作多情 提交于 2019-12-05 12:47:16
I have a list of images <img src="001.jpg"> <img src="002.jpg"> <img src="003.jpg"> <img src="004.jpg"> <img src="005.jpg"> Each image is 200px wide but the heights are different. Is there a way with Jquery to find, and then set the height of each image after they load? I plan on having dozens of images on a single page and don't want to add the width and height attribute to every single image tag. I am using the Masonry Plugin and it requires a width and height attribute for images. I believe this will do what you want: $('img').each(function() { $(this).attr('height',$(this).height()); $

Eclipse tab width not changing

痞子三分冷 提交于 2019-12-05 11:22:25
I've looked through a couple of posts related to this but they don't seem to help me solve my problem. I have a project where the java files are indented with a 2-space width. I would like to change everything to 4-space width. I tried the "correct indentation" option but it just moves everything back to a 2-space width when I modify a few lines to 4-space indentation. I've checked settings in Java->Code Style->Formatter and the default is 4-space width. I've also checked settings at General->Editors->Text Editors and they are set to 4-space tab width. I thought the correct indentation may

Why is using width:100% to make a table expand relatively to window size creates an undesired space?

别等时光非礼了梦想. 提交于 2019-12-05 09:56:56
I'm trying to create a website that will adjust the size of table elements table cells relative to the size of the window, so that it will always fit inside the window. Here's what I have: .table { display: table; margin-right: auto; margin-left: auto; width: 100%; } .tablecell { display: table-cell; } <div class="table"> <div class="tablecell"> <image src="fb.png"> </div> <div class="tablecell"> <image src="twitter.png"> </div> <div class="tablecell"> <image src="youtube.png"> </div> <div class="tablecell"> <image src="apple.png"> </div> <div class="tablecell"> <image src="email.png"> </div>

Determining the width of a webpage in inches

非 Y 不嫁゛ 提交于 2019-12-05 09:10:28
I have a CSS stylesheet that uses media queries to change how a page is displayed based on how many inches it is in width (for instance, if it is smaller than 4 inches or being displayed on a handheld device, it assumes a more mobile-friendly LAF). The problem I have is with its content. On the homepage, there is a dock-style interface that dynamically changes height based on the current height and width of the window so that the text and items never leave the screen. However, my JS that determines this size does not know when the stylesheet has changed for handheld devices or small screens,

How do I make a StringGrid's columns fit the grid's width?

孤街浪徒 提交于 2019-12-05 09:04:05
I've been looking for a long time for a solution without any luck. Does anyone know a simple way to do that? I would like to stretch for example the second colum of my grid to fit the grid's width! Use the ColWidths property, like so: with StringGrid1 do ColWidths[1] := ClientWidth - ColWidths[0] - 2 * GridLineWidth; And for a more robust and flexible solution, take all fixed columns into account and parameterize the column index: procedure SetColumnFullWidth(Grid: TStringGrid; ACol: Integer); var I: Integer; FixedWidth: Integer; begin with Grid do if ACol >= FixedCols then begin FixedWidth :=

How automatically adjust div's width using CSS?

吃可爱长大的小学妹 提交于 2019-12-05 07:59:59
问题 Consider the following example: HTML: <div class="wrapper"> <div class="left">Some text here</div><div class="right">Hello Stack Overflow</div> </div> CSS: .wrapper { border: 1px solid black; width: 400px; } .left { border: 1px solid green; display: inline-block; } .right { border: 1px solid red; display: inline-block; float: right; } I would like to force the width of the green div to be as big as possible, according to the width of the red one. The width of the red div can vary according to

Fill the space of a div

一世执手 提交于 2019-12-05 07:03:10
I would like an element to fill the remaining space of a parent div. I have managed to do this, You can see it here "link removed" but the filling div (right) sits underneath the left div. I bascially want the right div to start where the left div finishes. Hope this make sense. <html> <head> <title></title> <style type="text/css"> #left { float:left; width:180px; background-color:#ff0000; height:20px; } #right { width: 100%; background-color:#00FF00; height:30px; } </style> </head> <body> <div> <div id="left">Nav</div> <div id="right">This is the space I need to fill but not go underneath the

Change width of bars in barchart (R)

夙愿已清 提交于 2019-12-05 06:53:25
I am wondering how to change the width of the bars in the barchart() function. Here is the code: rater1 <- c(0.75, 0.66, 0.73, 0.63) barplot(rater1, ylim=c(0:1),axes = TRUE, names.arg = c("A", "B", "C", "D"), axisnames=TRUE, col="grey70") Is it also possible to place value labels above the bars? Thanks. From ?barplot : space: the amount of space (as a fraction of the average bar width) left before each bar. May be given as a single number or one number per bar. [...] So, for example, compare: tN <- table(Ni <- stats::rpois(100, lambda = 5)) barplot(tN, col = rainbow(20)) barplot(tN, col =

<li> elements with adapted width

六月ゝ 毕业季﹏ 提交于 2019-12-05 06:18:22
I'm wondering if it is possible to do this in CSS, without javascript: A list of N <li> items, with display inline, equal width, and the width of the all equal to the width of the container I can have 3 <li> items, in this case the <li> width will be 33%, or I can have 4 <li> items, then the li width will be 25%. It is possible with CSS3 flex boxes , as demonstrated in this fiddle (for webkit browsers only). There are other browser custom properties that would make this work for recent versions of Firefox and IE. If you need something that works for Opera or older versions of IE then there is

Center inline-blocks with dynamic width in CSS

隐身守侯 提交于 2019-12-05 05:29:21
问题 So.. I have a dynamic width page. Below, the wrapper div centers the divs inside of it. However, each div has a style of: display:inline-block; width:400px; /* static */ This makes the inside divs, side by side. But that means that there is some whitespace left over depending on the width of the browser and how many divs can go side by side without breaking to the next line. To get an idea of what I am going for, open up your Google Chrome New Tab page and drag your browser window to make it