Last active
November 25, 2016 00:38
-
-
Save nanjizal/8aa6e765af932ebed3a6a9eade445b6f to your computer and use it in GitHub Desktop.
CSS3 flexbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mac specific, last two line will need adjusting for pc and linux | |
-js test.js | |
-cp src | |
-main Main | |
-D js-flatten | |
-dce full | |
--next | |
-cmd echo '<!DOCTYPE html><meta charset="UTF-8"><html><head/><body><script src="test.js"></script></body></html>' >index.html | |
-cmd open index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import js.Browser; | |
import js.html.StyleElement; | |
import js.html.DivElement; | |
import js.html.BodyElement; | |
import js.html.CSSStyleDeclaration; | |
class Main{ | |
public static function main(){ | |
var body: BodyElement = cast Browser.document.body; | |
var doc = js.Browser.window.document; | |
var divSection = doc.createDivElement(); | |
var sectionStyle = divSection.style; | |
sectionStyle.display='flex'; | |
sectionStyle.maxWidth = '740px'; | |
sectionStyle.margin = '0 auto'; | |
var texts = ['first','second','third']; | |
body.appendChild( divSection ); | |
var div:DivElement; | |
var divStyle: CSSStyleDeclaration; | |
for( i in 0...3 ){ | |
div = doc.createDivElement(); | |
divStyle = div.style; | |
divStyle.margin = '10px'; | |
divStyle.flexGrow = '1'; | |
divStyle.flexShrink = '1'; | |
div.innerHTML = texts[ i ]; | |
divSection.appendChild( div ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment