I’m not very good at html,css,twcss. I need help.
Whenever I use justify-contents:space-between;
it moves some things down.
An image of my problem
justify acting wierd or my skill issue?
The following is my code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro">
<title>./T3RM1N4L</title>
</head>
<body data-sveltekit-preload-data="hover" onloa>
<div style="display: contents">
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script>
eruda.init();
</script>
<div class="flex justify-center">
<div class="flex justify-between items-center my-12 mx-2 flex-col">
<div class="text-5xl m-2">./T3RM1N4L</div>
<div class="border h-[8 rem] overflow-y-auto rounded-md snap-y" style="width: 800px">
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" height="19" width="19" viewBox="0 0 512 512">
<path fill="#ffffff" d="M0 96C0 60.7 28.7 32 64 32H196.1c19.1 0 37.4 7.6 50.9 21.1L289.9 96H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16H286.6c-10.6 0-20.8-4.2-28.3-11.7L213.1 87c-4.5-4.5-10.6-7-17-7H64z" />
</svg>
<a style="justify-content: start; right: auto !important; padding-left: 1rem; padding-right: 29rem; " href="./AnuraOSessentials/index.html">AnuraOS</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10" >18/09/2022</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1" >major </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" height="19" width="19" viewBox="0 0 512 512">
<path fill="#ffffff" d="M0 96C0 60.7 28.7 32 64 32H196.1c19.1 0 37.4 7.6 50.9 21.1L289.9 96H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16H286.6c-10.6 0-20.8-4.2-28.3-11.7L213.1 87c-4.5-4.5-10.6-7-17-7H64z" />
</svg>
<a style="justify-content: start; right: auto !important; padding-left: 1rem; padding-right: 30.25rem; " href="./ASCII/index.html">ASCII</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">24/11/2022</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">minor </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" height="19" width="19" viewBox="0 0 512 512">
<path fill="#ffffff" d="M0 96C0 60.7 28.7 32 64 32H196.1c19.1 0 37.4 7.6 50.9 21.1L289.9 96H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16H286.6c-10.6 0-20.8-4.2-28.3-11.7L213.1 87c-4.5-4.5-10.6-7-17-7H64z" />
</svg>
<div style="justify-content: space-between;">
<a style="padding-left: 1rem;" href="./education/index.html">Education</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">26/04/2023</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1" >major </div>
</div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./Emulation/index.html">Emulation</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">18/10/2023</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">major </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./H4cks/index.html">H4cks</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">00/00/0000</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">current </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./Images/index.html">Images</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">00/00/0000</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">latest </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./Important_MarkDowns/index.html">Important_MarkDowns</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">00/00/0000</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">latest </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./sedoms/index.html">Sedoms</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">00/00/0000</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">latest </div>
</div>
</div>
<div class="snap-center p-2 border rounded-md m-1 bg-slate-200 hover:bg-slate-300 cursor-pointer font-sans hover:border-slate-400 flex-row flex justify-between items-center">
<a href="./uhruhruhr/index.html">uhruhruhr</a>
<div class="flex flex-row gap-2 items-center">
<div class="text-slate-400 ml-10">00/00/0000</div>
<div class="text-sm bg-gray-400 rounded-md text-white p-1">latest </div>
</div>
</div>
</div>
<div class="text-sm font-thin italic">scroll</div>
</div>
</div>
<style>
*,
:before,
:after {
box-sizing: border-box;
border-width: 0;
border-style: solid;
border-color: #e5e7eb;
font-family: "Source Code Pro", sans-serif !important;
}
:before,
:after {
--tw-content: ""
}
body {
background-color: black !important;
color: white !important;
}
html {
line-height: 1.5;
-webkit-text-size-adjust: 100%;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
font-feature-settings: normal;
font-variation-settings: normal
}
body {
margin: 0;
line-height: inherit
}
hr {
height: 0;
color: inherit;
border-top-width: 1px
}
abbr:where([title]) {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: inherit;
font-weight: inherit
}
a {
color: inherit;
text-decoration: inherit;
}
b,
strong {
font-weight: bolder
}
code,
kbd,
samp,
pre {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
font-size: 1em
}
small {
font-size: 80%
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sub {
bottom: -.25em
}
sup {
top: -.5em
}
table {
text-indent: 0;
border-color: inherit;
border-collapse: collapse
}
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
font-size: 100%;
font-weight: inherit;
line-height: inherit;
color: inherit;
margin: 0;
padding: 0
}
button,
select {
text-transform: none
}
button,
[type=button],
[type=reset],
[type=submit] {
appearance: button;
background-color: transparent;
background-image: none
}
:-moz-focusring {
outline: auto
}
:-moz-ui-invalid {
box-shadow: none
}
progress {
vertical-align: baseline
}
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px
}
::-webkit-search-decoration {
-webkit-appearance: none
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit
}
summary {
display: list-item
}
blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
margin: 0
}
fieldset {
margin: 0;
padding: 0
}
legend {
padding: 0
}
ol,
ul,
menu {
list-style: none;
margin: 0;
padding: 0
}
textarea {
resize: vertical
}
input::-moz-placeholder,
textarea::-moz-placeholder {
opacity: 1;
color: #9ca3af
}
input::placeholder,
textarea::placeholder {
opacity: 1;
color: #9ca3af
}
button,
[role=button] {
cursor: pointer
}
:disabled {
cursor: default
}
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
display: block;
vertical-align: middle
}
img,
video {
max-width: 100%;
height: auto
}
[hidden] {
display: none
}
*,
:before,
:after {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-gradient-from-position: ;
--tw-gradient-via-position: ;
--tw-gradient-to-position: ;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / .5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia:
}
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-pan-x: ;
--tw-pan-y: ;
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
--tw-gradient-from-position: ;
--tw-gradient-via-position: ;
--tw-gradient-to-position: ;
--tw-ordinal: ;
--tw-slashed-zero: ;
--tw-numeric-figure: ;
--tw-numeric-spacing: ;
--tw-numeric-fraction: ;
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgb(59 130 246 / .5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
--tw-backdrop-blur: ;
--tw-backdrop-brightness: ;
--tw-backdrop-contrast: ;
--tw-backdrop-grayscale: ;
--tw-backdrop-hue-rotate: ;
--tw-backdrop-invert: ;
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia:
}
.m-1 {
margin: .25rem
}
.m-2 {
margin: .5rem
}
.mx-2 {
margin-left: .5rem;
margin-right: .5rem
}
.my-12 {
margin-top: 3rem;
margin-bottom: 3rem
}
.ml-10 {
margin-left: 2.5rem
}
.flex {
display: flex
}
.contents {
display: contents
}
.h-[3.5rem] {
height: 3.5rem
}
.cursor-pointer {
cursor: pointer
}
.snap-y {
scroll-snap-type: y var(--tw-scroll-snap-strictness)
}
.snap-center {
scroll-snap-align: center
}
.flex-row {
flex-direction: row
}
.flex-col {
flex-direction: column
}
.items-center {
align-items: center
}
.justify-center {
justify-content: center
}
.justify-between {
justify-content: space-between
}
.gap-2 {
gap: .5rem
}
.overflow-y-auto {
overflow-y: auto
}
.rounded-md {
border-radius: .375rem
}
.border {
border-width: 1px
}
.bg-gray-400 {
--tw-bg-opacity: 1;
background-color: rgb(156 163 175 / var(--tw-bg-opacity))
}
.bg-slate-200 {
--tw-bg-opacity: 1;
background-color: rgb(21 21 23 / var(--tw-bg-opacity))
}
.p-1 {
padding: .25rem
}
.p-2 {
padding: .5rem
}
.font-sans {
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji"
}
.text-5xl {
font-size: 3rem;
line-height: 1
}
.text-sm {
font-size: .875rem;
line-height: 1.25rem
}
.font-thin {
font-weight: 100
}
.italic {
font-style: italic
}
.text-slate-400 {
--tw-text-opacity: 1;
color: rgb(148 163 184 / var(--tw-text-opacity))
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity))
}
.hover:border-slate-400:hover {
--tw-border-opacity: 1;
border-color: rgb(148, 163, 184 / var(--tw-border-opacity))
}
.hover:bg-slate-300:hover {
--tw-bg-opacity: 1;
background-color: rgb(171, 203, 255 / var(--tw-bg-opacity))
}
</style>
</div>
</body>
</html> </style>
</div>
</body>
</html>
I tried messing around with padding, but I have to have a specific padding for each one. If I add justify content to one of the parent divs, it works, but the folder svg is at the left. I kind of want to make it look like github repos.
2
Answers
Most of the elements have
block
as defaultdisplay
, so it don’t have sub-properties offlex display
likejustify-content
.To have the effect set
display: flex
withjustify-content: space-between
.You need to have a
display: flex
property forjustify-content: space-between
to work.I also added a width: 100% to ensure that the flex container spans the full width of its parent element.