1
0
mirror of https://github.com/Chalarangelo/mini.css.git synced 2025-03-14 17:29:38 +01:00

Header styling

Missing logo, but buttons work perfectly fine.
This commit is contained in:
Angelos Chalaris 2017-11-07 20:29:04 +02:00
parent 63a1874855
commit 4a8d172ff6
5 changed files with 341 additions and 45 deletions

View File

@ -110,3 +110,6 @@
- Bundled up `[disabled]` styling for all elements in `input_control` as this should now be the default behavior of the code.
- Dealt with #114. It shouldn't be a problem anymore.
- Added mixins for `button` elements in `input_control`. They should now be perfectly usable.
- Removed `header` `display` fix as it was targeting IE 9-.
- Implemented `header` and links/buttons in it, `logo` is still missing.
- Implemented `.sticky` for all `navigation` elements that needed it.

View File

@ -8,7 +8,7 @@
--fore-color: #111;
--secondary-fore-color: #444;
--back-color: #f8f8f8;
--secondary-back-color: #eee;
--secondary-back-color: #f0f0f0;
--blockquote-color: #f57c00;
--pre-color: #1565c0;
--border-color: #aaa;
@ -25,6 +25,10 @@ html {
font-size: 16px;
}
a, b, del, em, i, ins, q, span, strong, u {
font-size: 1em;
}
html, * {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Helvetica, sans-serif;
line-height: 1.5;
@ -589,6 +593,17 @@ a:hover, a:focus {
/*
Definitions for forms and input elements.
*/
/* Input_control module CSS variable definitions */
:root {
--input-focus-color: #0288d1;
--input-invalid-color: #d32f2f;
--button-back-color: #e2e2e2;
--button-hover-back-color: #dcdcdc;
--button-fore-color: #212121;
--button-border-color: transparent;
--button-hover-border-color: transparent;
}
form {
background: var(--secondary-back-color);
border: 0.0625rem solid var(--secondary-border-color);
@ -604,6 +619,201 @@ fieldset {
padding: var(--universal-padding);
}
legend {
box-sizing: border-box;
display: table;
max-width: 100%;
white-space: normal;
font-weight: 700;
padding: calc(var(--universal-padding) / 2);
}
label {
padding: calc(var(--universal-padding) / 2) var(--universal-padding);
}
.input-group {
display: inline-block;
}
.input-group.fluid {
display: flex;
align-items: center;
justify-content: center;
}
.input-group.fluid > input {
flex-grow: 1;
flex-basis: 0px;
}
@media screen and (max-width: 767px) {
.input-group.fluid {
align-items: stretch;
flex-direction: column;
}
}
.input-group.vertical {
display: flex;
align-items: stretch;
flex-direction: column;
}
.input-group.vertical > input {
flex-grow: 1;
flex-basis: 0px;
}
[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
input:not([type]), [type="text"], [type="email"], [type="number"], [type="search"],
[type="password"], [type="url"], [type="tel"], textarea, select {
box-sizing: border-box;
background: var(--back-color);
color: var(--fore-color);
border: 0.0625rem solid var(--secondary-border-color);
border-radius: var(--universal-border-radius);
margin: calc(var(--universal-margin) / 2);
padding: var(--universal-padding) calc(1.5 * var(--universal-padding));
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]):hover, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus, textarea:hover, textarea:focus, select:hover, select:focus {
border-color: var(--input-focus-color);
box-shadow: none;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid {
border-color: var(--input-invalid-color);
box-shadow: none;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"])[readonly], textarea[readonly], select[readonly] {
background: var(--secondary-back-color);
}
select {
max-width: 100%;
}
option {
overflow: hidden;
text-overflow: ellipsis;
}
:placeholder-shown {
color: var(--fore-color);
}
::-ms-placeholder {
color: var(--fore-color);
opacity: 0.54;
}
button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button, html [type="button"], [type="reset"], [type="submit"] {
-webkit-appearance: button;
}
button {
overflow: visible;
text-transform: none;
}
button, [type="button"], [type="submit"], [type="reset"],
a.button, label.button, .button,
a[role="button"], label[role="button"], [role="button"] {
display: inline-block;
background: var(--button-back-color);
color: var(--button-fore-color);
border: 0.0625rem solid var(--button-border-color);
border-radius: var(--universal-border-radius);
padding: var(--universal-padding) calc(1.5 * var(--universal-padding));
margin: var(--universal-margin);
text-decoration: none;
cursor: pointer;
transition: background 0.3s;
}
button:hover, button:focus, [type="button"]:hover, [type="button"]:focus, [type="submit"]:hover, [type="submit"]:focus, [type="reset"]:hover, [type="reset"]:focus,
a.button:hover,
a.button:focus, label.button:hover, label.button:focus, .button:hover, .button:focus,
a[role="button"]:hover,
a[role="button"]:focus, label[role="button"]:hover, label[role="button"]:focus, [role="button"]:hover, [role="button"]:focus {
background: var(--button-hover-back-color);
border-color: var(--button-hover-border-color);
}
input:disabled, input[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled], button:disabled, button[disabled], .button:disabled, .button[disabled], [role="button"]:disabled, [role="button"][disabled] {
cursor: not-allowed;
opacity: 0.75;
}
/*
Definitions for navigation elements.
*/
/* Navigation module CSS variable definitions */
:root {
--header-back-color: #f8f8f8;
--header-hover-back-color: #f0f0f0;
--header-fore-color: #444;
--header-border-color: #ddd;
}
header {
height: 3.1875rem;
background: var(--header-back-color);
color: var(--header-fore-color);
border-bottom: 0.0625rem solid var(--header-border-color);
padding: calc(var(--universal-padding) / 4) 0;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
}
header.row {
box-sizing: content-box;
}
header button, header [type="button"],
header a.button, header label.button, header .button,
header a[role="button"], header label[role="button"], header [role="button"] {
position: relative;
top: calc(0rem - var(--universal-padding) / 4);
height: calc(100% + var(--universal-padding) / 2);
background: var(--header-back-color);
color: var(--header-fore-color);
border: 0;
border-radius: 0;
vertical-align: top;
margin: 0;
text-transform: uppercase;
}
header button:hover, header button:focus, header [type="button"]:hover, header [type="button"]:focus,
header a.button:hover,
header a.button:focus, header label.button:hover, header label.button:focus, header .button:hover, header .button:focus,
header a[role="button"]:hover,
header a[role="button"]:focus, header label[role="button"]:hover, header label[role="button"]:focus, header [role="button"]:hover, header [role="button"]:focus {
background: var(--header-hover-back-color);
}
:not(.doc) {
font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Helvetica, sans-serif;
}
@ -732,28 +942,6 @@ p.splash {
cursor: pointer;
}
header {
display: block;
height: 3.25rem;
background: #f8f8f8;
color: #444;
padding: 0.125rem 0.5rem;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
position: sticky;
border-bottom: 1px solid #ddd;
top: 0;
text-transform: uppercase;
line-height: 3.5rem;
font-weight: 500;
cursor: pointer;
}
header:hover {
color: #111;
}
[type="checkbox"], [type="radio"] {
height: 1px;
width: 1px;

View File

@ -127,27 +127,27 @@ p.splash {
}
// TODO: Replace with actual header when ready
header {
display: block;
height: 3.25rem;
background: #f8f8f8;
color: #444;
padding: 0.125rem 0.5rem;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
position: sticky;
border-bottom: 1px solid #ddd;
top: 0;
text-transform: uppercase;
// Rough testing draft, not for production use
line-height: 3.5rem;
font-weight: 500;
cursor: pointer;
&:hover {
color: #111;
}
}
// header {
// display: block;
// height: 3.25rem;
// background: #f8f8f8;
// color: #444;
// padding: 0.125rem 0.5rem;
// white-space: nowrap;
// overflow-x: auto;
// overflow-y: hidden;
// position: sticky;
// border-bottom: 1px solid #ddd;
// top: 0;
// text-transform: uppercase;
// // Rough testing draft, not for production use
// line-height: 3.5rem;
// font-weight: 500;
// cursor: pointer;
// &:hover {
// color: #111;
// }
// }
// TODO: Use module, copied from v2

View File

@ -40,7 +40,7 @@ $sub-bottom: -0.25em !default; // <sub> bottom
$a-link-color: #0277bd !default; // Color for <a>:link
$a-visited-color: #01579b !default; // Color for <a>:visited
// CSS variable name definitions [exercise caution if modifying these]
$fore-color-var: '--fore-color';
$fore-color-var: '--fore-color' !default;
$secondary-fore-color-var: '--secondary-fore-color' !default;
$back-color-var: '--back-color' !default;
$secondary-back-color-var: '--secondary-back-color' !default;

View File

@ -0,0 +1,105 @@
/*
Definitions for navigation elements.
*/
// Different elements are styled based on the same set of rules.
$header-height: 3.1875rem !default; // Height of the header element.
$header-back-color: #f8f8f8 !default; // Background color for the header element.
$header-hover-back-color: #f0f0f0 !default; // Background color for the header element (hover).
$header-fore-color: #444 !default; // Text color for the header element.
$header-border-color: #ddd !default; // Border color for the header element.
$_header-only-bottom-border: true !default; // [Hidden] Apply styling only to the bottom border of header? (boolean)
$_header-links-uppercase: true !default; // [Hidden] Should header links and buttons be uppercase? (boolean)
$sticky-name: 'sticky' !default; // Class name for sticky headers and footers.
// CSS variable name definitions [exercise caution if modifying these]
$header-fore-color-var: '--header-fore-color' !default;
$header-back-color-var: '--header-back-color' !default;
$header-hover-back-color-var: '--header-hover-back-color' !default;
$header-border-color-var: '--header-border-color' !default;
/* Navigation module CSS variable definitions */
:root {
#{$header-back-color-var}: $header-back-color;
#{$header-hover-back-color-var}: $header-hover-back-color;
#{$header-fore-color-var}: $header-fore-color;
#{$header-border-color-var}: $header-border-color;
}
// Header styling. - No box-shadow as it causes lots of weird bugs in Chrome. No margin as it shouldn't have any.
header {
height: $header-height;
background: var(#{$header-back-color-var}); // Always apply background color to avoid shine through
color: var(#{$header-fore-color-var});
@if $_header-only-bottom-border {
border-bottom: $__1px solid var(#{$header-border-color-var});
}
@else {
border: $__1px solid var(#{$header-border-color-var});
}
padding: calc(var(#{$universal-padding-var}) / 4) 0;
// Responsiveness for smaller displays, scrolls horizontally.
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
// Fix for responsive header, using the grid system's row and column alignment.
&.#{$grid-row-name} {
box-sizing: content-box;
}
// Header logo styling.
// .#{$header-logo-name} {
// @if $header-colorize-svgs { // Deals with SVG colorization in case people use SVGs.
// color: $header-fore-color; // Only toggle off if you know what you're doing.
// }
// @if $header-logo-font-size != $base-font-size {
// font-size: $header-logo-font-size;
// }
// @if $header-logo-line-height != $base-line-height {
// line-height: $header-logo-line-height;
// }
// @if $header-logo-margin != 0 {
// margin: $header-logo-margin;
// }
// @if $header-logo-padding != 0 {
// padding: $header-logo-padding;
// }
// @if $apply-link-hover-fade {
// transition: opacity 0.3s ;
// }
// }
// Link styling.
button, [type="button"],
a.#{$button-class-name}, label.#{$button-class-name}, .#{$button-class-name},
a[role="button"], label[role="button"], [role="button"] {
position: relative;
top: calc(0rem - var(#{$universal-padding-var}) / 4); // Use universal-padding to offset the padding of the header.
height: calc(100% + var(#{$universal-padding-var}) / 2); // Fill header.
background: var(#{$header-back-color-var}); // Apply color regardless to override styling from other things.
color: var(#{$header-fore-color-var});
border: 0;
border-radius: 0;
vertical-align: top; // Alignemt, really important to make this work well.
margin: 0;
@if $_header-links-uppercase {
text-transform: uppercase;
}
&:hover, &:focus {
background: var(#{$header-hover-back-color-var});
}
}
// @if $apply-link-underline { // Override for links if underline is enabled.
// .#{$header-logo-name}, a.#{$button-class-name}, a[role="button"] {
// text-decoration: none;
// }
// }
}
// TODO: Add footer definitions here.
// Definitions for sticky headers and footers.
header.#{$sticky-name} {
position: -webkit-sticky; // One of the rare instances where prefixes are necessary.
position: sticky;
z-index: 1101; // Deals with certain problems when combined with cards and tables.
top: 0;
}
footer.#{$sticky-name} {
position: -webkit-sticky; // One of the rare instances where prefixes are necessary.
position: sticky;
z-index: 1101; // Deals with certain problems when combined with cards and tables.
bottom: 0;
}