width

min-width and max-width with the same value?

无人久伴 提交于 2019-12-19 16:51:47
问题 In the past, I saw the next css and I was thinking if there is some actual difference between min-width: 90px; max-width: 90px; and width: 90px; 回答1: using width will simply specify fixed width over the element without paying attention to its content (so you can have overflow) : div { width: 80px; border:2px solid red; } <div> <img src="https://lorempixel.com/200/100/" /> </div> Using max-width means that the element will have an upper bound for its width. So its width can be from 0 to max

min-width and max-width with the same value?

一个人想着一个人 提交于 2019-12-19 16:51:16
问题 In the past, I saw the next css and I was thinking if there is some actual difference between min-width: 90px; max-width: 90px; and width: 90px; 回答1: using width will simply specify fixed width over the element without paying attention to its content (so you can have overflow) : div { width: 80px; border:2px solid red; } <div> <img src="https://lorempixel.com/200/100/" /> </div> Using max-width means that the element will have an upper bound for its width. So its width can be from 0 to max

16:9 aspect ratio with fixed width

烂漫一生 提交于 2019-12-19 14:05:13
问题 If I were to embed a YouTube video for example <iframe width="560" src="http://www.youtube.com/embed/25LBTSUEU0A" class="player" frameborder="0" allowfullscreen></iframe> Using jQuery would I set a height with an aspect ration of 16:9 so if the width is 560 the height should be 315px. I have this jquery to set a height but I dont know how to apply the 16:9 ratio $('.player').parent().attr('width', ':9ratio'); or can this be done neatly using css? 回答1: Aspect ratio is just width:height. So if

getting screen width into javascript variable and sending it through ajax to a php page to avoid page load

☆樱花仙子☆ 提交于 2019-12-19 12:28:13
问题 This is the JS to detect the screen resolution on my page naming index.html and sending it to php, so that the values can be retrived using $_GET :- <script type="text/javascript"> width = screen.availwidth; height = screen.availheight; if (width > 0 && height >0) { window.location.href = "http://localhost/main.php?width=" + width + "&height=" + height; } else exit(); </script> This is the content of my PHP file naming process.php :- <?php $screen_width = $_GET['width']; $screen_height = $

Convert pixel to percentage using javascript

一世执手 提交于 2019-12-19 12:05:35
问题 I have a table header's width in pixel. on click of a function i need to convert pixel to percentage. <th field="Column1" id="Column1" noresize="true" width="100px"> <label id="Column1" onclick="getCustomGridColName(this.id,'inner__fghgh');" style="cursor:pointer; font-family: Times; font-size:12pt;"> Column1 </label> </th> 回答1: percentage is a relative value. with one value like 100px you cannot make a percentage. you need to have relative value like screenWidth (for suppose) 1366px so that

Getting image width and height with jquery

大城市里の小女人 提交于 2019-12-19 11:29:37
问题 I have a very simple code, which annoyingly was working and for the life of me I can not see why it is now failing: function imageSize(img){ var theImage = new Image(); theImage.src = img.attr('src'); var imgwidth = theImage.width; var imgheight = theImage.height; alert(imgwidth+'-'+imgheight); } The "img" variable being passed is the img object, obtained from: jQuery('img') .each(function(){ var imgsrc = jQuery(this); imageSize(imgsrc); }); 回答1: The image may not have loaded yet. So, try

100% width divs not spanning entire width of the browser in webkit

你离开我真会死。 提交于 2019-12-19 05:11:10
问题 I'm having a hard time with what I thought would be a dead simple issue. I'm trying to create a div that spans 100% of the width of a browser window. The div is filled with several child divs that expand to fill that entire space with alternating colors like a football field. These divs would expand to fit the full width of a given space that has individual 1% stripes that fill that space fully. This seems to work fine in Firefox, but in Safari (and Chrome) the calculation seems to be too

Custom width and height on fancybox image

不打扰是莪最后的温柔 提交于 2019-12-19 03:43:08
问题 I wonder if it is posible to set a custom width and height on fancybox images? As a standard, the width and height of the fancybox changes in relative to the width and height of the images, but i want to be 800 width and 600 height, at all images. I want to create something familiar to the image-box on facebook, where you see the image at the left, and description and comments at the right. Could be great if someone could help me with this... :) TheYaXxE 回答1: A simpler way is to change the

How can I make a div dynamically change to content width and have it remain that width even as the browser window changes size?

不打扰是莪最后的温柔 提交于 2019-12-19 03:24:38
问题 Take a look at this: (Scenario 1) #container { height:150px; border:1px solid pink; width:1100px; } #widget { display:inline-block; width:100px; height:100px; background-color:red; }​ http://jsfiddle.net/DQFja/1/ Very simple. A div with a bunch of other divs within it. Parent div has a fixed width of ~1000 pixels, children divs are set to display:inline-block; When you make the browser window smaller than the parent, a scroll bar appears and you can scroll to see the rest. Now take a look at

CSS 2 div size auto same height

本小妞迷上赌 提交于 2019-12-18 17:55:19
问题 i have an question in CSS: How i can do that: When the green div has (auto) 500px height for the content the red got the same. And when the red has (auto) 700px height for the content the green got the same. Both have any content then i use auto height. So how i can do the green has the same width as red and red too but whit different content whit "height: auto;"? 回答1: I would just wrap both DIVS, inside another div, and have them bump up on the parent DIV, then resize the parent Something