computed-style

Defining minimum available height before floating divs?

↘锁芯ラ 提交于 2019-12-01 10:49:08
问题 I arrange multiple boxes (divs) in two columns using float:left for all of them. The divs have different heights, resulting in a layout like this: AAA BBB AAA BBB AAA AAA CCC CCC CCC CCC But I want to define a minimal height (minimum available space), when a box must float in the left column. I want a result similar to this: AAA BBB AAA BBB AAA AAA CCC CCC CCC CCC I suppose that is not possible ... but however maybe there is a css trick? Thanks, Konrad 回答1: Use a floated element above a

how to query whole DOM for elements matching some computed style ? (in pure js)

风格不统一 提交于 2019-11-30 14:56:45
For example I want to find all elements that have computed style position: fixed; . How to do it without making much load on the CPU ? Is iterating every getElementsByTagName('*') and then doing for loop the only way ? Instead of selecting all ( * ) elements, and use getComputedStyle + getPropertyValue , you can follow the following steps: Loop through all CSS rules (via document.styleSheets [1] ) and take the selectors which contains position: fixed . Select all elements whose style attribute contains position: fixed`. Use document.querySelectorAll to select all elements which match the

Detecting width: auto in jQuery

为君一笑 提交于 2019-11-30 11:44:37
I'm retrieving the width of elements using jQuery and would prefer it if I could have an indication of whether there was an explicit width (and height) specified. <div id="test"></div> <script type="text/javascript"> $(function() { alert($('#test').css('width')); }); </script> This will alert the implicit width of the div in terms of how many pixels it takes up on the client's screen. Is there any way that if the width is either missing or set as width: auto that it can be verified using jQuery? That is, instead of the above example returning an integer, it would return either auto or

how to query whole DOM for elements matching some computed style ? (in pure js)

老子叫甜甜 提交于 2019-11-29 21:12:35
问题 For example I want to find all elements that have computed style position: fixed; . How to do it without making much load on the CPU ? Is iterating every getElementsByTagName('*') and then doing for loop the only way ? 回答1: Instead of selecting all ( * ) elements, and use getComputedStyle + getPropertyValue , you can follow the following steps: Loop through all CSS rules (via document.styleSheets [1] ) and take the selectors which contains position: fixed . Select all elements whose style

What's the difference between rgba(0,0,0,0) and transparent?

纵然是瞬间 提交于 2019-11-28 16:12:41
问题 In one of my other questions, the solution to fixing a rendering issue was by using the value rgba(255, 255, 255, 255) instead of transparent. We tested using rgba(0, 0, 0, 0) and this still corrected the problem, meaning that it is the definition of transparent that causes the error. However, looking at the W3C CSS3 Specification (and MDN reference) for transparent reveals that rgba(0, 0, 0, 0) and transparent should be equal: transparent Fully transparent. This keyword can be considered a

Set / Copy javascript computed style from one element to another

天涯浪子 提交于 2019-11-27 05:34:44
So I am trieing to copy all the style that apply on one element ( class / id / tagName / attribute etc. ). So far I found out that I can copy the computed style of an element, Just one problem ... couldend apply it on outher element ;/ or diffrend way to copy all the style. (this is as far as i got :/ ) http://jsfiddle.net/8KdJd/2/ //queriks mode + minor changes to retrive the computed style function getCS(el) { if (el.currentStyle) var y = el.currentStyle; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(el,null); return y; } function setCS(el,cs) { if (el

Get computed font-family in JavaScript

六月ゝ 毕业季﹏ 提交于 2019-11-26 20:47:38
This is a followup to this question . I am working on a component for the CKEditor , a tweaked version of the font drop-down menus that always display the currently selected font family / size values, no matter where they were defined, using computedStyle and consorts. As you can see in the other question, determining the font size works cross-browser now. Now I am having trouble working with the fontFamily attribute. My generic "computed style" function returns only the full font string that was defined, e.g. Times New Roman, Georgia, Serif What I need, in order to match the setting against

How do I get a computed style?

一世执手 提交于 2019-11-26 12:24:05
Can anybody please help me with a script.. or a way to get the value of height : 1196px; width: 284px; from the computed style sheet (webkit). I know IE is different- as usual. I cannot access the iframe (cross domain)—I just need the height/width. Screenshot of what I need (circled in red). How do I access those properties? Source <iframe id="frameId" src="anotherdomain\brsstart.htm"> <html id="brshtml" xmlns="http://www.w3.org/1999/xhtml"> \--I WANT THIS ELEMENTS COMPUTED BROWSER CSS HEIGHT/WIDTH <head> <title>Untitled Page</title> </head> <body> BLA BLA BLA STUFF </body> </html> \--- $('

Get computed font-family in JavaScript

空扰寡人 提交于 2019-11-26 07:45:34
问题 This is a followup to this question. I am working on a component for the CKEditor, a tweaked version of the font drop-down menus that always display the currently selected font family / size values, no matter where they were defined, using computedStyle and consorts. As you can see in the other question, determining the font size works cross-browser now. Now I am having trouble working with the fontFamily attribute. My generic \"computed style\" function returns only the full font string that