Unwanted Space Between Spans Flex - html

I'm trying to use a flexbox with flex-wrap: wrap to place these two pieces of together. It should say Welcome with the subtitle immediately below. Instead, each span seems to be taking up way too much space, but adjusting the heights instead helping. What could be going on here?
class SignUp extends Component {
render() {
return (
<React.Fragment >
<div id={"container"}>
<div id={"signup-container"}>
<span className={"suTitle"}><p>Welcome!</p></span>
<span className={"subtitle"}><p>Sign up for a free account today.</p></span>
</div>
</div>
</React.Fragment>
);
}
}
.suTitle{
width: 100%;
height: 10%;
padding: 5%;
margin: 0;
background-color: black;
font-family: 'Poppins';
font-style: normal;
font-weight: 700;
font-size: 50px;
color: #0064FF;
}
.subtitle {
font-family: 'Poppins';
font-style: normal;
font-weight: 500;
font-size: 30px;
padding: 5%;
margin: 0;
color: rgba(51, 51, 51, 0.5);
}
#container {
display: flex;
height: 100%;
justify-content: right;
background: linear-gradient(247.13deg, rgba(0, 100, 255, 0.8) 0%, rgba(101, 215, 192, 0.8) 68.23%, rgba(2, 186, 144, 0.8) 100%);
}
#signup-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
right: 0;
background-color: white;
}

Related

How to dynamically change size of html container?

I have a container div that is a background that changes size dynamically with the window. Inside that container I have an image div that I want to change size with the background container. I can't seem to get it to resize dynamically even using percentage heights and widths. Can anyone guide me in the correct direction?
#import url("https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600,700,800");
* {
box-sizing: border-box;
}
body {
background-color: #af39fe;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
min-height: 100vh;
font-family: "Fira Sans", sans-serif;
display: flex;
}
.info-container {
width: 95%;
position: relative;
max-width: 800px;
margin: auto;
background: #fff;
box-shadow: 0px 14px 80px rgba(34, 35, 58, 0.2);
padding: 25px;
border-radius: 10px;
height: auto;
}
.info-container__img {
width: 400px;
flex-shrink: 0;
height: 400px;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
box-shadow: 4px 13px 30px 1px rgba(252, 56, 56, 0.2);
border-radius: 10px;
transform: translateX(-80px);
overflow: hidden;
}
.info-container__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
opacity: 100;
border-radius: 10px;
}
.info-container__content {
padding-right: 25px;
}
.info-container__content>* {
opacity: 100;
}
.info-container__title {
font-size: 24px;
font-weight: 700;
color: #0d0925;
margin-bottom: 20px;
}
.info-container__text {
color: #4e4a67;
margin-bottom: 30px;
line-height: 1.5em;
}
.info-container__button {
display: inline-flex;
background-image: linear-gradient(147deg, #5b0a6b 0%, #16034b 74%);
padding: 15px 35px;
border-radius: 50px;
color: #fff;
box-shadow: 0px 14px 80px rgba(0, 0, 0, 0.4);
text-decoration: none;
font-weight: 500;
justify-content: center;
text-align: center;
letter-spacing: 1px;
}
<div class="info-container">
<div class="info-container__img">
<img src="https://www.dmarge.com/wp-content/uploads/2021/01/dwayne-the-rock-.jpg">
</div>
<div class="info-container__content">
<div class="info-container__title">About Me</div>
<div class="info-container__text">This is fake info about a persons life.</div>
READ MORE
</div>
</div>
You set .info-container__img's width using pixels. Change that to percentages and it would act as you want. I set max-width: 400px and change width: 50% in respect to container's style.
#import url("https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600,700,800");
* {
box-sizing: border-box;
}
body {
background-color: #af39fe;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
min-height: 100vh;
font-family: "Fira Sans", sans-serif;
display: flex;
}
.info-container {
width: 95%;
position: relative;
max-width: 800px;
margin: auto;
background: #fff;
box-shadow: 0px 14px 80px rgba(34, 35, 58, 0.2);
padding: 25px;
border-radius: 10px;
height: auto;
}
.info-container__img {
width: 50%;
max-width: 400px;
flex-shrink: 0;
height: auto;
background-image: linear-gradient(147deg, #af39fe 0%, #4c38fd 74%);
box-shadow: 4px 13px 30px 1px rgba(252, 56, 56, 0.2);
border-radius: 10px;
transform: translateX(-80px);
overflow: hidden;
}
.info-container__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
opacity: 100;
border-radius: 10px;
}
.info-container__content {
padding-right: 25px;
}
.info-container__content>* {
opacity: 100;
}
.info-container__title {
font-size: 24px;
font-weight: 700;
color: #0d0925;
margin-bottom: 20px;
}
.info-container__text {
color: #4e4a67;
margin-bottom: 30px;
line-height: 1.5em;
}
.info-container__button {
display: inline-flex;
background-image: linear-gradient(147deg, #5b0a6b 0%, #16034b 74%);
padding: 15px 35px;
border-radius: 50px;
color: #fff;
box-shadow: 0px 14px 80px rgba(0, 0, 0, 0.4);
text-decoration: none;
font-weight: 500;
justify-content: center;
text-align: center;
letter-spacing: 1px;
}
<div class="info-container">
<div class="info-container__img">
<img src="https://www.dmarge.com/wp-content/uploads/2021/01/dwayne-the-rock-.jpg">
</div>
<div class="info-container__content">
<div class="info-container__title">About Me</div>
<div class="info-container__text">This is fake info about a persons life.</div>
READ MORE
</div>
</div>

How can I fix a div class not getting styling?

You will see below that I attempted to create a divclass for a button - however, for some reason, only that divclass doesn't get any styling.
Please help me out to figure out why ctabutton class doesn't get styling. There were supposed to be borders around. I'm probably missing something very easy to notice - please give me wisdom.
Here is a link to codepen: https://codepen.io/CanYildiz/pen/ExEYmZb
:root {
--black: rgba(0, 0, 0, 1);
--alllports: rgba(8, 116, 183, 1);
--white: rgba(255, 255, 255, 1);
--font-size-xs: 10px;
--font-size-s: 14px;
--font-size-m: 15px;
--font-size-l: 28px;
--font-family-inter: Sans-Serif;
--font-family-lato: "Lato";
}
#import url("https://fonts.googleapis.com/css?family=Inter:400,700|Lato:500");
.container {
align-items: flex-start;
background-color: var(--white);
display: flex;
flex-direction: column;
min-height: 469px;
width: 666px;
border: 1px solid var(--black);
}
.hidden,
.hidden * {
pointer-events: none;
visibility: hidden;
}
.pflichttext {
color: #094e7c;
cursor: pointer;
font-family: var(--font-family-inter);
font-size: var(--font-size-xs);
font-weight: 400;
letter-spacing: 0;
margin-top: 8px;
min-height: 15px;
text-decoration: underline;
width: 666px;
}
.container-1 {
align-items: flex-start;
cursor: pointer;
display: flex;
flex-direction: column;
min-height: 45px;
width: 666px;
}
.ctabutton {
display: inline-block;
align-items: flex-start;
text-decoration: none;
border: 5px solid var(--allports);
border-radius: 4px;
display: flex;
height: 44px;
margin-left: 3px;
margin-top: 8px;
min-width: 106px;
padding: 14px 16px;
}
.cta-text {
color: var(--allports);
font-family: var(--font-family-lato);
font-size: var(--font-size-s);
font-weight: 500;
height: 14px;
letter-spacing: 0;
line-height: 14px;
min-width: 72px;
text-align: center;
white-space: nowrap;
}
.valign-text-middle {
display: flex;
flex-direction: column;
justify-content: center;
}
.image-1 {
height: 312px;
object-fit: cover;
width: 666px;
}
.frame-1 {
align-items: flex-start;
display: flex;
flex-direction: column;
margin-top: 9px;
min-height: 73px;
width: 664px;
}
.description {
color: #595858;
font-family: var(--font-family-inter);
font-size: var(--font-size-m);
font-weight: 400;
letter-spacing: 0;
margin-top: 3px;
min-height: 36px;
width: 664px;
}
.title {
color: var(--black);
font-family: Sans-Serif;
font-size: var(--font-size-l);
font-weight: 700;
letter-spacing: 0;
margin-top: -1px;
min-height: 34px;
width: 664px;
}
<div class="container screen">
<div class="container-1">
<img class="image-1" src="https://cdn.animaapp.com/projects/62b868b9500e6d0650eef4d7/releases/62b868bf500e6d0650eef4d8/img/image-1#1x.png" />
<div class=" frame-1">
<h1 class="title">TITLE</h1>
<p class="description">
Description about the product/service advertise!It is relatively longer than the Title itself.But just long enough to contain extra information
</p>
</div>
<div class="ctabutton">
<a href="clickurl.de" target="_blank">
<div class="cta-text valign-text-middle">CTATEXT</div>
</a>
</div>
<a href="https://demo.de" target="_blank">
<div class="pflichttext">Pflichttext</div>
</a>
</div>
The border style is not being applied because you have the root css variable named --alllports when an extra 'l' and you are trying to reference it by --allports on the class.
you're original code
:root {
--black: rgba(0, 0, 0, 1);
--alllports: rgba(8, 116, 183, 1);
--white: rgba(255, 255, 255, 1);
--font-size-xs: 10px;
--font-size-s: 14px;
--font-size-m: 15px;
--font-size-l: 28px;
--font-family-inter: Sans-Serif;
--font-family-lato: "Lato";
}
when it should be
:root {
--black: rgba(0, 0, 0, 1);
--allports: rgba(8, 116, 183, 1);
--white: rgba(255, 255, 255, 1);
--font-size-xs: 10px;
--font-size-s: 14px;
--font-size-m: 15px;
--font-size-l: 28px;
--font-family-inter: Sans-Serif;
--font-family-lato: "Lato";
}

How to keep element with position: absolute on the same position when resizing

How to keep element with position: absolute on the same position when resizing?
I would like to have the button inside my input, but the problem is when I am trying to use position relative on parent and absolute on children it is not working as I want.
Right now, the element is on the correct position when the width of the browser is 375px
Maybe there is a diffrent solution?
<main class="page-main">
<h1 class="page-main__title">
<span>We're</span>
coming soon
</h1>
<p class="page-main__text">
Hello fellow shoppers! We're currently building our new fashion store. Add your
email below to stay up-to-date with announcemenets and our launch deals.
</p>
<form class="page-main__form">
<label for="email"></label>
<input
type="email"
class="page-main__input"
placeholder="Email adress"
id="email"
required
/>
<button name="submit" type="submit class="page-main__button">
<img src="images/icon-arrow.svg" alt="" />
</button>
</form>
</main>
.page-main {
width: 100%;
min-height: 100vh;
&__title {
display: block;
margin: 0 auto;
color: hsl(0, 6%, 24%);
padding-top: 3rem;
text-align: center;
font-size: 3rem;
font-weight: 600;
letter-spacing: 10px;
text-transform: uppercase;
width: 300px;
span {
color: hsl(0, 36%, 70%);
font-weight: 300;
}
}
&__text {
padding-top: 20px;
display: block;
margin: 0 auto;
width: 300px;
font-size: 14px;
font-weight: 400;
color: hsl(0, 36%, 70%);
text-align: center;
}
&__form {
display: flex;
justify-content: center;
flex-direction: row;
padding-top: 40px;
}
&__input {
width: 250px;
height: 40px;
border: 1px solid hsl(0, 36%, 70%);
border-radius: 28px;
opacity: 0.5;
position: relative;
}
}
input::placeholder {
color: hsl(0, 36%, 70%);
font-weight: 400;
padding-left: 20px;
}
button {
border-radius: 28px;
width: 80px;
height: 45px;
border: 0;
box-shadow: 0 3px 5px 1px hsla(0, 36%, 70%, 0.5);
background: linear-gradient(135deg, hsl(0, 80%, 86%), hsl(0, 74%, 74%));
position: absolute;
right:60px;
}
You just need to wrap label and input in single DIV with position: relative.
Refer below snippet.
jsfiddle:
https://jsfiddle.net/hardyrajput/hfzmv230/28/

designing hover slider drop down menu in css

I am trying to design a simple hover slider, in which if i hover on it, a drop down menu should slide downwards, and the movement i hover the background color of the button should also change.
while designing this i created a normal button gave it some color now when i am trying to hover on it,its not changing its color.I wrapped my slider button and slider contents in slider class, button have class of slidercontact and slider contents are in slidercontent class(which is not shown in the following code).
i expected the color change, but no color was changed.
.media {
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.background {
z-index: 1;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(43, 74, 111, 0.2);
}
.contents {
display: flex;
justify-content: center;
z-index: 2;
font-style: italic;
font-weight: bold;
color: rgb(27, 5, 58);
border: solid 10px rgba(3, 35, 54, 0.6);
padding: -3%;
}
.slidercontact {
width: 80px;
font-style: italic;
font-size: 1.1em;
color: rgb(7, 18, 58);
background-color: rgba(122, 134, 173, 0.5);
border: 3px solid rgb(6, 21, 57);
}
.slider {
display: flex;
margin-right: 1.9%;
margin-top: -5%;
margin-bottom: 1%;
flex-direction: column;
align-items: flex-end;
}
.slider:hover .slidercontact {
background-color: rgb(277, 0, 0);
}
<div class="media">
<video src="video.mov" autoplay loop muted></video>`
</div>
<div class="background"></div>
<div class="contents">
<h1>Registration Page</h1>
</div>
<div class="slider">
<button class="slidercontact">EmailID</button>
</div>
Your .background has a z-index: 1, effectively covering the page and catching all mouse events, including hover. To let the pointer-events pass through it, give it a
pointer-events: none;
See it working:
.media {
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.background {
pointer-events: none; /* <=== here */
z-index: 1;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(43, 74, 111, 0.2);
}
.contents {
display: flex;
justify-content: center;
z-index: 2;
font-style: italic;
font-weight: bold;
color: rgb(27, 5, 58);
border: solid 10px rgba(3, 35, 54, 0.6);
padding: -3%;
}
.slidercontact {
width: 80px;
font-style: italic;
font-size: 1.1em;
color: rgb(7, 18, 58);
background-color: rgba(122, 134, 173, 0.5);
border: 3px solid rgb(6, 21, 57);
}
.slider {
display: flex;
margin-right: 1.9%;
margin-top: -5%;
margin-bottom: 1%;
flex-direction: column;
align-items: flex-end;
}
.slider:hover .slidercontact {
background-color: rgb(277, 0, 0);
}
<div class="media">
<video src="video.mov" autoplay loop muted></video>`
</div>
<div class="background"></div>
<div class="contents">
<h1>Registration Page</h1>
</div>
<div class="slider">
<button class="slidercontact">EmailID</button>
</div>

Flexbox container doesn't fit children's height in Chrome

I have three flexbox containers (header, .content__description and footer) and two of them (header and .content__description) don't fit the children's height in Chrome, but only in Firefox. Therefore, the first container is covered by the second one. Why does it occur?
/* util.css */
.break {
width: 100%;
}
/* An issue
html,
body {
height: 100%;
}
*/
/* The solution I found */
html {
height: 100%;
}
body {
min-height: 100%;
}
/* Other styles */
body {
display: flex;
flex-direction: column;
justify-content: space-between;
color: rgb(255, 255, 255);
background-color: rgb(20, 142, 210);
}
header {
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
margin-top: 3em;
margin-bottom: 3em;
}
.header__logo {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding-bottom: 1em;
}
.header__logo img {
width: 3em;
height: 3.3em;
margin-right: 0.6em;
}
.header__logo span {
font-size: 5em;
font-weight: 400;
}
.header__slogan {
font-size: 1.5em;
font-weight: 400;
text-align: center;
}
.content {
margin-left: auto;
margin-right: auto;
}
.content__description {
display: flex;
flex-direction: column;
padding-top: 3em;
padding-bottom: 3em;
background-color: rgb(0, 114, 174);
position: relative;
}
.content__description__signin {
position: absolute;
text-decoration: none;
text-align: center;
color: black;
background-color: rgb(254, 190, 0);
box-sizing: border-box;
font-size: 2em;
border: 0.2em rgb(255, 255, 255) solid;
line-height: 1em;
width: 6em;
padding: 0.2em;
top: calc(100% - 0.9em);
left: calc(50% - 3em);
}
.content__description__signin:hover {
background-color: rgb(241, 177, 0);
}
.content__description__strep {
width: 13em;
text-align: center;
font-size: 2em;
box-sizing: border-box;
}
.content__description__strep img {
width: 5em;
height: 5em;
border: 0.2em rgb(255, 255, 255) solid;
border-radius: 50%;
box-shadow: 0.2em 0.5em 1em rgba(0, 0, 0, 0.3);
box-sizing: border-box;
margin-bottom: 1em;
}
.content__description__strep figcaption {
background-color: rgb(2, 98, 148);
padding: 1em;
margin-left: -1em;
margin-right: -1em;
}
footer {
flex-grow: 1;
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
min-height: 1.8em;
}
<body>
<header>
<div class="header__logo">
<img src="images/logo.svg" alt="logo">
<span>Sailing</span>
</div>
<span class="break"></span>
<h1 class="header__slogan">You can!</h1>
</header>
<div class="content">
<div class="content__description">
<figure class="content__description__strep">
<img src="images/meeting.jpg" alt="meeting">
<figcaption>Talking</figcaption>
</figure>
<figure class="content__description__strep">
<img src="images/sailing.jpg" alt="sailing">
<figcaption>Sailing</figcaption>
</figure>
<figure class="content__description__strep">
<img src="images/cinema.jpg" alt="cinema">
<figcaption>Watching</figcaption>
</figure>
Sign in
</div>
</div>
<footer> </footer>
</body>
EDIT #1
The display style of .content__description is changed to "flex" (misprint).
EDIT #2
I've found the solution - switched body {height: 100%} to body {min-height: 100%}. It works perfectly for me.