how can i put curves little above ?

i tried everything and margin -1em worked but i don't know if it's a right way to do it ?
No description
96 Replies
ἔρως
ἔρως3w ago
we can't possibly tell you without checking the code
peterpumkineaterr
oops i forgot to add codepen
peterpumkineaterr
curves.svg wasn't showing so i had to put svg code in curves div otherwise my html looks like this
<div class="box">
<h1 class="text">we're designing<br>come back later.</h1>
<div class="bottom">
<div class="curves"></div>
</div>
</div>
<div class="box">
<h1 class="text">we're designing<br>come back later.</h1>
<div class="bottom">
<div class="curves"></div>
</div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,100..900;1,9..144,100..900&display=swap");

$font: (
font-family: "fraunces",
font-optical-sizing: auto,
font-weight: 700,
font-style: normal,
font-variation-settings: (
"SOFT" 0,
"WONK" 0
)
);

$primary-color: (#88c574);
$secondary-color: (#fbffdb);

body {
background-color: $primary-color;
color: white;
margin: 0;
font-family: "fraunces", serif;
background-image: url("noise-light.png");
display: grid;
grid-template-rows: auto 1fr auto; /* Header, Main Content, Footer */
min-height: 100vh;
}

.box {
display: grid;
grid-template-rows: 7fr 3fr; /* 70% top, 30% bottom */
grid-template-columns: 1fr;
height: 100vh;

h1 {
display: grid;
place-items: center; /* Center text horizontally and vertically */
color: #104d00;
font-family: "fraunces";
font-optical-sizing: auto;
font-weight: 900;
font-style: normal;
font-variation-settings: ("SOFT" 0, "WONK" 0);
font-size: 4rem;
text-align: center;
margin: 0;
height: 70vh;

}

.bottom {
display: grid;
position: relative;
background-color: #104d00;
align-items: start; /* Push curves to the bottom */
justify-items: stretch;

.curves {
height: 2.5rem;
width: 100%;
background-repeat: repeat-x;
background-size: contain;
background-image: url("curves.svg");
}
}
}
@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,100..900;1,9..144,100..900&display=swap");

$font: (
font-family: "fraunces",
font-optical-sizing: auto,
font-weight: 700,
font-style: normal,
font-variation-settings: (
"SOFT" 0,
"WONK" 0
)
);

$primary-color: (#88c574);
$secondary-color: (#fbffdb);

body {
background-color: $primary-color;
color: white;
margin: 0;
font-family: "fraunces", serif;
background-image: url("noise-light.png");
display: grid;
grid-template-rows: auto 1fr auto; /* Header, Main Content, Footer */
min-height: 100vh;
}

.box {
display: grid;
grid-template-rows: 7fr 3fr; /* 70% top, 30% bottom */
grid-template-columns: 1fr;
height: 100vh;

h1 {
display: grid;
place-items: center; /* Center text horizontally and vertically */
color: #104d00;
font-family: "fraunces";
font-optical-sizing: auto;
font-weight: 900;
font-style: normal;
font-variation-settings: ("SOFT" 0, "WONK" 0);
font-size: 4rem;
text-align: center;
margin: 0;
height: 70vh;

}

.bottom {
display: grid;
position: relative;
background-color: #104d00;
align-items: start; /* Push curves to the bottom */
justify-items: stretch;

.curves {
height: 2.5rem;
width: 100%;
background-repeat: repeat-x;
background-size: contain;
background-image: url("curves.svg");
}
}
}
i also tried it with flex.
Jochem
Jochem3w ago
moving it up a bit is definitely the way to do it, how depends on the use case and contents. I'd probably just use a negative margin too
peterpumkineaterr
really ? is it normal to do ?
Jochem
Jochem3w ago
it used to be, and I've been doing this a looooong time 😄 There's heaps other ways probably, but if it doesn't break anything there's no reason to overcomplicate
peterpumkineaterr
this is flex code
body {
background-color: $primary-color;
color: white;
margin: 0;
background-image: url("noise-light.png");
}

.box {
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
height: 100vh;

.text {
align-content: center;
}

h1 {
color: #104d00;
font-family: "fraunces";
font-optical-sizing: auto;
font-weight: 900;
font-style: normal;
font-variation-settings: ("SOFT" 0, "WONK" 0);
font-size: 4rem;
text-align: center;
margin: 0 auto 0 auto;
height: 70vh;
}

.bottom {
background-color: #104d00;
height: 30vh;
margin: 0;
bottom: 0;
left: 0;
z-index: 0 !important;


.curves {
position: absolute;
bottom: 0; /* Align to the bottom */
width: 100%;
height: 2rem;

&::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
bottom: 0;
left: 0;
background-repeat: repeat-x;
background-size: contain;
background-image: url("curves.svg");
}
}
}
}
body {
background-color: $primary-color;
color: white;
margin: 0;
background-image: url("noise-light.png");
}

.box {
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
height: 100vh;

.text {
align-content: center;
}

h1 {
color: #104d00;
font-family: "fraunces";
font-optical-sizing: auto;
font-weight: 900;
font-style: normal;
font-variation-settings: ("SOFT" 0, "WONK" 0);
font-size: 4rem;
text-align: center;
margin: 0 auto 0 auto;
height: 70vh;
}

.bottom {
background-color: #104d00;
height: 30vh;
margin: 0;
bottom: 0;
left: 0;
z-index: 0 !important;


.curves {
position: absolute;
bottom: 0; /* Align to the bottom */
width: 100%;
height: 2rem;

&::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
bottom: 0;
left: 0;
background-repeat: repeat-x;
background-size: contain;
background-image: url("curves.svg");
}
}
}
}
right can you take a look at the website how arc did it they just have top 0 and left 0 and it is defenetly aligning
peterpumkineaterr
Thanks for downloading Arc!
Experience a calmer, more personal internet in this browser designed for you. Let go of the clicks, the clutter, the distractions.
peterpumkineaterr
i inspected the site
peterpumkineaterr
i mean what should even say here
No description
peterpumkineaterr
i did same but it is not working
Jochem
Jochem3w ago
Their SVG probably just matches the two colors like, the top is the blue and the bottom is the whiteish
peterpumkineaterr
how they even put ::after in div ?
ἔρως
ἔρως3w ago
a background image
peterpumkineaterr
yes
ἔρως
ἔρως3w ago
divs support ::after and it has a content
Jochem
Jochem3w ago
by having .c-jmqsMK::after in their CSS somewhere? that's how after is shown in the DOM
ἔρως
ἔρως3w ago
then has the background image
peterpumkineaterr
but why it wasn't supporting mine oh so they didn't manually typed ::after in dom
ἔρως
ἔρως3w ago
position absolute inside position absolute sounds like a recepie for disaster
peterpumkineaterr
is there any way to it without minus margin
ἔρως
ἔρως3w ago
also, is the svg in the same folder as the html file?
peterpumkineaterr
yes everthing is naked
ἔρως
ἔρως3w ago
position absolute, grid, vertical-align
peterpumkineaterr
i'm not used to grid can you tell me in flex ?
ἔρως
ἔρως3w ago
flex doesn't do grid that well, so, nope
Jochem
Jochem3w ago
also you can do a linear gradient to fake the background changing color early or late whichever
ἔρως
ἔρως3w ago
or multiple backgrounds
Jochem
Jochem3w ago
basically you make the element containing the squiggle look like the top bit is still the div above by giving it that background color, then have the background color change where it's covered by the squiggle
peterpumkineaterr
no no i don't want to change color
Jochem
Jochem3w ago
ya do though? that's one green, then squiggle, then another, different green?
peterpumkineaterr
i made bottom green so i can see if it covered it or not by curves
Jochem
Jochem3w ago
then I don't think I understand what problem you're having
peterpumkineaterr
after that i'm giving secondary color to bottom part same as curves
Jochem
Jochem3w ago
so you're transitioning from green to the yellow?
ἔρως
ἔρως3w ago
so, the background color of the bottom is the same as the curves?
peterpumkineaterr
i didn't make figma of this cause it was supposed to be 10 minute work so
Jochem
Jochem3w ago
that still works just fine with the linear-gradient trick, you just adjust the colors
peterpumkineaterr
final i'm expecting of course the bottom green will have some social media icons
No description
Jochem
Jochem3w ago
the top of what is now darkgreen would then be light green so it looks like the light green keeps going, and then in the part covered by the squiggle, you change the background to the squiggle color so the rest of the same div looks like it's the same color as the squiggle
peterpumkineaterr
how do they do it ?
ἔρως
ἔρως3w ago
an svg with position absolute
Jochem
Jochem3w ago
the SVG has the color set to the values they need to be to blend in
ἔρως
ἔρως3w ago
or just transparent or something
peterpumkineaterr
sorry jochem this is how it will look
No description
peterpumkineaterr
not dark green but how did the div got little bottom or should i say how did the svg got little up ? i didn't fully understand this tho
ἔρως
ἔρως3w ago
top: 0 there's nothing special about it in fact, the whole position thing is absolutely useless it's just on top of the div
Jochem
Jochem3w ago
excuse the artists rendering, but you make the div where the squiggle lives look like this:
No description
Jochem
Jochem3w ago
the red lines are the squiggle, and the gradient transition is hidden by the squiggle that way, the top looks like it matches the element above, and the bottom below the squiggle looks like it matches the squiggle but it's just one of many ways you can do this, and not even necessarily the best
ἔρως
ἔρως3w ago
that's a sensible way to do it, if everything is the same background i would do the same that the arc team did
Jochem
Jochem3w ago
I agree that's probably the best, yeah. I just hate making SVGs 🤣
peterpumkineaterr
no it's inside of the div
ἔρως
ἔρως3w ago
at the top it's just 2 divs one next to the other
peterpumkineaterr
c-j is the bottom div and the svg div is inside understood like you said minus margin won't hurt so ima do that and put it as a construction site.
ἔρως
ἔρως3w ago
you don't need to do that
peterpumkineaterr
so what should i do ?
ἔρως
ἔρως3w ago
nothing you can do absolutely nothing, and it still works
peterpumkineaterr
how ?
ἔρως
ἔρως3w ago
by not doing anything
peterpumkineaterr
then it looks like this !!
No description
ἔρως
ἔρως3w ago
no position, no margin, no alignment, no padding ... just do nothing then, instead of ::before, use ::after but on the parent and set the svg fill to the same color as the next section's background color
peterpumkineaterr
curves should be inside of bottom container ?
ἔρως
ἔρως3w ago
try it
peterpumkineaterr
it is gone
ἔρως
ἔρως3w ago
and the code?
ἔρως
ἔρως3w ago
you don't have content and you made an useless div: just move the class to the other element and move the styles outside the nesting
peterpumkineaterr
what do you mean by content ? can you show me ?
peterpumkineaterr
this is the code for that sorry i was testing somethin' earlier
No description
ἔρως
ἔρως3w ago
look at the selector the first one
peterpumkineaterr
selector ? which
ἔρως
ἔρως3w ago
^
peterpumkineaterr
you mean bottom ::after ? what's wrong with that ?
ἔρως
ἔρως3w ago
after doesn't take elements
peterpumkineaterr
then should i give it to curves ? if i do that then curves hides somewhere
ἔρως
ἔρως3w ago
it's not a "should" but a "must" you have display grid on that one
peterpumkineaterr
site is done thanks for the help guys i appreciate it.
ἔρως
ἔρως3w ago
so, that means you got it to work?
peterpumkineaterr
Haha i just used margin-1em I tried bro but it didn’t work 😭
ἔρως
ἔρως3w ago
it's a way to do it, for sure
peterpumkineaterr
what you mean ? there's another way also ?
ἔρως
ἔρως3w ago
this entire post is many other ways to do it
peterpumkineaterr
please enlighten me
ἔρως
ἔρως3w ago
one of the ways was to do nothing at all
Jochem
Jochem3w ago
we went over several options last week when you posted this, I'm not really sure what else you expect?
peterpumkineaterr
let me create a codepen and show me what you meant !!
ἔρως
ἔρως2w ago
what i mean is to just throw an svg at the top that's all
peterpumkineaterr
open it in this view
peterpumkineaterr
i didn't know how to put that svg in there as i directly used it in scss instead of putting it in html i don't know how to do that please show me
Want results from more Discord servers?
Add your server