JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td style="width:200px; height:200px;">Hello World</td>
</tr>
</table>
<div>Apply the TD styles to this DIV (instead of the TD).</div>
<p>Goodbye world!</p>
CSS
td {
padding:20px;
border:1px solid red;
color:yellow;
background:blue;
border-radius:15px;
transition: all 1s;
}
div {
}
p {
color:red;
}
JavaScript
/*
Copyright 2013 Mike Dunn
http://upshots.org/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function ($) {
$.fn.getStyles = function (only, except) {
// the map to return with requested styles and values as KVP
var product = {};
// the style object from the DOM element we need to iterate through
var style;
// recycle the name of the style attribute
var name;
// if it's a limited list, no need to run through the entire style object
if (only && only instanceof Array) {
for (var i = 0, l = only.length; i < l; i++) {
// since we have the name already, just return via built-in .css method
name = only[i];
product[name] = this.css(name);
}
} else {
// otherwise, we need to get everything
var dom = this.get(0);
// standards
if (window.getComputedStyle) {
// convenience methods to turn css...