From 27b41d936454f25b1fc9fb8254b84e3a1f2bb5d7 Mon Sep 17 00:00:00 2001 From: miguel bracamontes Date: Sat, 17 Aug 2024 23:37:45 -0600 Subject: [PATCH 1/2] add styles for buttons and change px to rem project wide --- style.css | 107 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 28 deletions(-) diff --git a/style.css b/style.css index e2567c7..bab579b 100644 --- a/style.css +++ b/style.css @@ -6,23 +6,11 @@ body, html { font-family: "Inter", sans-serif; + font-size: 16px; background-color: #f3f5fc; height: 100%; } -textarea { - width: auto; - height: 70%; - background: transparent; - border: none; - box-shadow: none; - outline: none; - resize: none; - font-family: "Inter", sans-serif; - font-size: 32px; - color: #0a3871; -} - /* Container for the entire layout */ .container { display: flex; @@ -30,21 +18,34 @@ textarea { justify-content: center; gap: 1rem; height: 100vh; - padding: 40px; + padding: 2.5rem; } /* Left side, logo */ .logo { flex: 1; - max-width: 120px; + max-width: 7.5rem; } .logo__image { - width: 31px; - height: 50px; + width: 1.938rem; + height: 3.125rem; } /* Center side: Text input area */ +textarea { + width: auto; + height: 70%; + background: transparent; + border: none; + box-shadow: none; + outline: none; + resize: none; + font-family: "Inter", sans-serif; + font-size: 2rem; + color: #0a3871; +} + .input { display: flex; flex: 2; @@ -53,42 +54,85 @@ textarea { } .input__requirement { - font-size: 12px; + font-size: 0.75rem; color: #495057; } .input__warning { color: red; - font-size: 14px; - margin-top: 10px; + font-size: 0.875rem; + margin-top: 0.625rem; display: none; } +.buttons { + display: flex; + align-items: center; + gap: 1rem; + margin-top: 1rem; + margin-bottom: 0; + max-width: 100%; +} + +#encrypt, #decrypt, #copyText { + width: 20.5rem; + padding: 0.8rem; + border-radius: 1.5rem; + border: 0.063rem solid #0a3871;/* or add a custom border */ + background: transparent; /* or a custom background color */ + outline: none; /* ensure no outline */ + text-decoration: none; /* ensure no text decoration */ + margin: 0; /* or adjust as needed */ + font: inherit; /* inherits font style from parent */ + cursor: pointer; /* pointer cursor on hover */ +} + /* Right side: Default image and Results */ .results { display: flex; flex: 3; flex-direction: column; justify-content: center; - max-width: 400px; + max-width: 25rem; background-color: #ffffff; - border-radius: 32px; - padding: 32px; + border-radius: 2rem; + padding: 2rem; + box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 8%); } -/* Basic styling for the container and image */ #defaultMessage { display: flex; flex-direction: column; - align-items: center; /* centers content horizontally */ + align-items: center; } #defaultImage { - width: 100%; /* adjust as needed */ - height: auto; /* maintains aspect ratio */ + width: 100%; + height: auto; +} + +/* Responsiveness */ +@media (max-width: 1200px) { + .container { + flex-direction: column; + } + + .results { + max-width: 100%; + } + + #defaultImage { + display: none; + } + + .buttons { + max-width: 100%; + justify-content: center; + } + } -@media (max-width: 900px) { +@media (max-width: 450px) { .container { flex-direction: column; } @@ -100,4 +144,11 @@ textarea { #defaultImage { display: none; } + + .buttons { + flex-direction: column; + max-width: 100%; + justify-content: center; + } + } \ No newline at end of file From b364c644fa9647352b126c06b3192963e42eb9c9 Mon Sep 17 00:00:00 2001 From: miguel bracamontes Date: Sun, 18 Aug 2024 03:02:16 -0600 Subject: [PATCH 2/2] optimize css adding variables --- index.html | 6 +-- style.css | 112 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 72 insertions(+), 46 deletions(-) diff --git a/index.html b/index.html index 45899d8..f338166 100644 --- a/index.html +++ b/index.html @@ -14,12 +14,12 @@
- + - +

a-z only, no specials

@@ -30,7 +30,7 @@

- +
Default Image diff --git a/style.css b/style.css index bab579b..1712149 100644 --- a/style.css +++ b/style.css @@ -1,3 +1,24 @@ +:root { + --font-family: "Inter", sans-serif; + --font-size-base: 16px; + --background-color: #f3f5fc; + --primary-color: #0a3871; + --secondary-color: #495057; + --button-padding: 0.8rem; + --button-border-radius: 1.5rem; + --button-border-width: 0.063rem; + --button-border-color: #0a3871; + --button-background: transparent; + --button-cursor: pointer; + --results-background: #ffffff; + --results-border-radius: 2rem; + --results-padding: 1.5rem; + --results-box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 8%); + --image-width: 100%; + --image-height: auto; + --warning-color: red; +} + * { margin: 0; padding: 0; @@ -5,9 +26,9 @@ } body, html { - font-family: "Inter", sans-serif; - font-size: 16px; - background-color: #f3f5fc; + font-family: var(--font-family); + font-size: var(--font-size-base); + background-color: var(--background-color); height: 100%; } @@ -41,9 +62,9 @@ textarea { box-shadow: none; outline: none; resize: none; - font-family: "Inter", sans-serif; + font-family: var(--font-family); font-size: 2rem; - color: #0a3871; + color: var(--primary-color); } .input { @@ -54,12 +75,12 @@ textarea { } .input__requirement { - font-size: 0.75rem; - color: #495057; + font-size: 0.75rem; + color: var(--secondary-color); } .input__warning { - color: red; + color: var(--warning-color); font-size: 0.875rem; margin-top: 0.625rem; display: none; @@ -76,15 +97,16 @@ textarea { #encrypt, #decrypt, #copyText { width: 20.5rem; - padding: 0.8rem; - border-radius: 1.5rem; - border: 0.063rem solid #0a3871;/* or add a custom border */ - background: transparent; /* or a custom background color */ - outline: none; /* ensure no outline */ - text-decoration: none; /* ensure no text decoration */ - margin: 0; /* or adjust as needed */ - font: inherit; /* inherits font style from parent */ - cursor: pointer; /* pointer cursor on hover */ + max-width: 100%; + padding: var(--button-padding); + border-radius: var(--button-border-radius); + border: var(--button-border-width) solid var(--button-border-color); + background: var(--button-background); + outline: none; + text-decoration: none; + margin: 0; + font: inherit; + cursor: var(--button-cursor); } /* Right side: Default image and Results */ @@ -94,10 +116,10 @@ textarea { flex-direction: column; justify-content: center; max-width: 25rem; - background-color: #ffffff; - border-radius: 2rem; - padding: 2rem; - box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 8%); + background-color: var(--results-background); + border-radius: var(--results-border-radius); + padding: var(--results-padding); + box-shadow: var(--results-box-shadow); } #defaultMessage { @@ -107,32 +129,32 @@ textarea { } #defaultImage { - width: 100%; - height: auto; + width: var(--image-width); + height: var(--image-height); } -/* Responsiveness */ -@media (max-width: 1200px) { - .container { - flex-direction: column; - } - - .results { - max-width: 100%; - } - - #defaultImage { - display: none; - } +#resultContainer { + display: flex; +} - .buttons { - max-width: 100%; - justify-content: center; - } +#resultText { + overflow-wrap: break-word; + word-break: break-word; + white-space: pre-wrap; + box-sizing: border-box; +} +#copyText { + margin-top: auto; + border-radius: var(--button-border-radius); /* Consistent button styling */ + border: var(--button-border-width) solid var(--button-border-color); /* Consistent button styling */ + background: var(--button-background); /* Consistent button styling */ + cursor: var(--button-cursor); /* Pointer cursor on hover */ } -@media (max-width: 450px) { + +/* Responsiveness */ +@media (max-width: 1200px), (max-width: 450px) { .container { flex-direction: column; } @@ -146,9 +168,13 @@ textarea { } .buttons { - flex-direction: column; max-width: 100%; justify-content: center; } -} \ No newline at end of file + @media (max-width: 450px) { + .buttons { + flex-direction: column; + } + } +}