From 0dbbca96ed8137b82bc428c88cde50585c565002 Mon Sep 17 00:00:00 2001 From: Ryan Sobol Date: Sun, 15 May 2016 08:46:38 -0700 Subject: [PATCH] Refactor to flexbox --- app.css | 36 +++++++++--------------------------- app.js | 8 ++------ 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/app.css b/app.css index a621988..128c976 100644 --- a/app.css +++ b/app.css @@ -15,37 +15,23 @@ h2 { font-family: Gill Sans; font-size: 1.5rem; font-weight: 400; - float: left; letter-spacing: 3px; - line-height: 2.4rem; - margin: 0; + line-height: 2.2rem; + margin: 6px 0 0 10px; } main { background: #e5e5e5; border-radius: 3.5%; box-shadow: 0 0 20px #999; - margin: 0 auto; - margin-top: 2%; + margin: 2% auto 0; padding: 2%; width: 905px; } -#canvas { - clear: both; - margin: 0 auto; -} - -#palette { - clear: both; - height: 100px; - width: 100%; -} - .pixel { background: white; border: 1px solid #e5e5e5; - float: left; height: 14px; width: 14px; } @@ -54,23 +40,19 @@ main { border: 1px solid #bbbbbb; border-radius: 50%; height: 35.5px; - float: left; margin: 5px 5px 0 0; width: 35.5px; } -.selection { - float: left; - height: 35.5px; - margin-top: 6px; - padding-left: 18px; -} - .current { border: 1px solid #999999; border-radius: 5%; - float: left; height: 35.5px; - margin-left: 12px; + margin: 6px 0 0 12px; width: 100px; } + +#canvas, #palette { + display: flex; + flex-wrap: wrap; +} diff --git a/app.js b/app.js index 2da7353..2dd5ce6 100644 --- a/app.js +++ b/app.js @@ -69,18 +69,14 @@ var drawPalette = function() { palette.appendChild(color); } - var selection = document.createElement('div'); - selection.className = 'selection'; - var heading = document.createElement('h2'); heading.textContent = 'CURRENT COLOR >'; var current = document.createElement('div'); current.className = 'current'; - selection.appendChild(heading); - selection.appendChild(current); - palette.appendChild(selection); + palette.appendChild(heading); + palette.appendChild(current); palette.addEventListener('click', function(event) { if (event.target.className !== 'color') {