Skip to content

Instantly share code, notes, and snippets.

@surajbera
Last active December 5, 2024 02:55
Show Gist options
  • Save surajbera/7a3493bef6e227fe11dec2e8e2c689e0 to your computer and use it in GitHub Desktop.
Save surajbera/7a3493bef6e227fe11dec2e8e2c689e0 to your computer and use it in GitHub Desktop.
Grid Layout CSS
$gutter-vertical: 30px; // Adjust the value as needed for your design
$gutter-horizontal: 30px; // Adjust the value as needed for your design
@mixin clearfix {
&::after {
content: "";
display: table;
clear: both;
}
}
.row {
@include clearfix;
&:not(:last-child) {
margin-bottom: $gutter-vertical;
}
/* there are 3 selectors: start(^), ending($), contains(*) */
[class^='col-'] {
float: left;
&:not(:last-child) {
margin-right: $gutter-horizontal;
}
}
.col-1-of-2 {
width: calc((100% - $gutter-horizontal) / 2);
}
.col-1-of-3 {
width: calc((100% - (2 * $gutter-horizontal)) / 3);
}
.col-1-of-4 {
width: calc((100% - (3 * $gutter-horizontal)) / 4);
}
.col-2-of-3 {
width: calc(2 * ((100% - 2 * $gutter-horizontal) / 3) + $gutter-horizontal);
/* basically (2 * .col-1-of-3) + (1 * $gutter-horizontal) */
}
.col-2-of-4 {
width: calc(2 * ((100% - (3 * $gutter-horizontal)) / 4) + $gutter-horizontal);
/* basically (2 * .col-1-of-4) + (1 * $gutter-horizontal) */
}
}
**********************************************
* {
word-break: break-word;
}
html {
-webkit-text-size-adjust: 100%;
}
pre {
font-family: monospace;
font-size: 0.8em;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
b,
b *,
strong,
strong * {
font-weight: 700;
}
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
[type='button'],
[type='reset'],
[type='submit'],
button {
-webkit-appearance: button;
}
[type='button']::-moz-focus-inner,
[type='reset']::-moz-focus-inner,
[type='submit']::-moz-focus-inner,
button::-moz-focus-inner {
border-style: none;
padding: 0;
}
button,
input,
optgroup,
select,
textarea {
font: inherit;
outline: none;
border: none;
outline: none;
color: inherit;
-webkit-appearance: none;
}
input::-webkit-input-placeholder {
color: inherit;
}
input::-moz-placeholder {
color: inherit;
}
input:-ms-input-placeholder {
color: inherit;
}
input::-ms-input-placeholder {
color: inherit;
}
input::placeholder {
color: inherit;
}
[type='submit'] {
cursor: pointer;
}
fieldset {
padding: 0.35em 0.75em 0.625em;
}
legend {
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
progress {
vertical-align: baseline;
}
textarea {
resize: none;
}
[type='checkbox'],
[type='radio'] {
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
[type='number']::-webkit-inner-spin-button,
[type='number']::-webkit-outer-spin-button {
height: auto;
}
[type='search']::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
[hidden] {
display: none;
}
a,
abbr,
acronym,
address,
applet,
article,
aside,
audio,
b,
big,
blockquote,
body,
canvas,
caption,
center,
cite,
code,
dd,
del,
details,
dfn,
div,
dl,
dt,
em,
embed,
fieldset,
figcaption,
figure,
footer,
form,
h1,
h2,
h3,
h4,
h5,
h6,
header,
hgroup,
html,
i,
iframe,
img,
ins,
kbd,
label,
legend,
li,
mark,
menu,
nav,
object,
ol,
output,
p,
pre,
q,
ruby,
s,
samp,
section,
small,
span,
strike,
strong,
sub,
summary,
sup,
table,
tbody,
td,
tfoot,
th,
thead,
time,
tr,
tt,
u,
ul,
video {
margin: 0;
padding: 0;
border: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section {
display: block;
}
blockquote,
q {
quotes: none;
}
blockquote:after,
blockquote:before,
q:after,
q:before {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
*,
::after,
::before {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
ol,
ul {
padding: 0;
}
button {
background: transparent;
cursor: pointer;
}
html {
font-size: 62.5%;
}
/***************************** style.css ********************************/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap');
:root {
--site-font: Inter, sans-serif;
--selection-bg-clr: #bfdbfe;
--black-clr: #000;
--white-clr: #fff;
--text-clr: #000;
--dark-bg: #1b182c;
--primary-clr: #4a2fed;
--secondary-clr: #ba32eb;
--gray-clr: #e4e4e4;
--gray-clr-2: #898989;
--gray-clr-3: #f5f5f5;
--gray-clr-4: #888;
--gray-clr-5: #a7a7a7;
--gray-clr-6: #878e99;
--gray-clr-7: #d6dbea;
--black-clr-2: #0f0d15;
--black-clr-3: #9ca3af;
--black-clr-4: #6b7280;
--black-clr-5: #0d0f18;
--black-clr-6: #595959;
--black-clr-7: #1e2243;
--black-clr-8: #454e5a;
--black-clr-9: #171c30;
--danger: #f87171;
--link-color: #0167ff;
}
::-moz-selection {
color: var(--black-clr);
background: var(--selection-bg-clr);
}
::selection {
color: var(--black-clr);
background: var(--selection-bg-clr);
}
body {
font-family: var(--site-font);
min-height: 100vh;
min-height: 100dvh;
position: relative;
font-weight: 400;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 1.6rem;
background-color: var(--white-clr);
color: var(--text-clr);
}
.d-flex {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
https://amio.github.io/embedded-google-fonts/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment