I have a style that I'm trying to implement into my web page.
.dp-htkhbrvt {
align-items: flex-start;
background-color: #fafffc;
border: 0.07vw none;
display: flex;
height: 71.11vw;
padding: 0 0.01vw;
width: 100.0vw;
}
.dp-htkhbrvt .text-7 {
color: var(--black);
margin-left: 4.38vw;
margin-top: 68.89vw;
min-height: 1.11vw;
min-width: 3.4vw;
}
.dp-htkhbrvt .text-6 {
color: var(--black);
margin-left: 1.39vw;
margin-top: 68.89vw;
min-height: 1.11vw;
min-width: 2.36vw;
}
.dp-htkhbrvt .flex-col {
align-items: flex-start;
display: flex;
flex-direction: column;
gap: 3.4vw;
margin-left: 23.68vw;
margin-top: 13.26vw;
min-height: 57.85vw;
width: 64.79vw;
}
.dp-htkhbrvt .logo-option-2 {
height: 5.35vw;
margin-left: 7.36vw;
width: 14.86vw;
}
.dp-htkhbrvt .overlap-group {
height: 49.1vw;
position: relative;
width: 64.79vw;
}
.dp-htkhbrvt .log-in-card {
align-items: center;
background-color: #ffffff;
border-radius: 0.35vw;
box-shadow: 0.0vw 0.62vw 3.19vw #0000001a;
display: flex;
flex-direction: column;
gap: 1.39vw;
height: 27.08vw;
left: 0;
padding: 2.78vw 2.08vw;
position: absolute;
top: 0;
width: fit-content;
}
.dp-htkhbrvt .text-1 {
color: var(--black);
margin-top: -0.07vw;
width: fit-content;
}
.dp-htkhbrvt .type-bar-icon-right {
gap: 16.53vw;
height: 3.26vw;
padding: 0.9vw 0.69vw 0.9vw 0.0vw;
}
.dp-htkhbrvt .group-8 {
align-self: stretch;
height: 1.46vw;
margin-right: -0.14vw;
min-width: 6.67vw;
position: relative;
}
.dp-htkhbrvt .text_label {
color: var(--black);
direction: rtl;
font-weight: 400;
left: 0;
line-height: normal;
opacity: 0.5;
position: absolute;
top: 0;
}
.dp-htkhbrvt .type-bar-icon-left {
padding: 0.9vw 0.69vw;
}
.dp-htkhbrvt .icon-eye {
height: 1.67vw;
min-width: 1.67vw;
}
.dp-htkhbrvt .text-2 {
align-self: stretch;
color: #000000cc;
flex: 1;
margin-top: -0.05vw;
opacity: 0.5;
}
.dp-htkhbrvt .text-3 {
align-self: stretch;
color: var(--black);
flex: 1;
font-family: var(--font-family-arimo);
font-size: var(--font-size-m);
letter-spacing: 0;
text-decoration: underline;
}
.dp-htkhbrvt .primary-action-btn {
background-color: var(--main);
border-radius: 0.35vw;
height: 3.47vw;
min-width: 25.35vw;
position: relative;
}
.dp-htkhbrvt .text-4 {
color: var(--black);
left: 10.07vw;
position: absolute;
top: 0.9vw;
}
.dp-htkhbrvt .text-5 {
color: var(--black);
text-align: center;
width: fit-content;
}
.dp-htkhbrvt .illustration-1 {
height: 24.31vw;
left: 24.38vw;
position: absolute;
top: 24.79vw;
width: 40.42vw;
}
.dp-htkhbrvt .text {
direction: rtl;
font-weight: 400;
line-height: normal;
}
.dp-htkhbrvt .type-bar-icon {
align-items: center;
border: 0.05vw solid;
border-color: var(--black);
border-radius: 0.35vw;
display: flex;
justify-content: flex-end;
width: 25.35vw;
}
<input type="hidden" id="anPageName" name="page" value="dp-htkhbrvt" />
<div class="container-center-horizontal">
<div class="dp-htkhbrvt text-14px screen">
<div class="text-7 text">צור קשר</div>
<div class="text-6 text">אודות</div>
<div class="flex-col">
<img class="logo-option-2" src="{% static 'images/img/logo.svg' %}" alt="logo option 2" />
<div class="overlap-group">
<div class="log-in-card">
<h2 class="text-1 text h2">כניסה למערכת</h2>
<div class="type-bar-icon-right type-bar-icon">
<div class="group-8">
<div class="text_label text">שם משתמש</div>
</div>
</div>
<div class="type-bar-icon-left type-bar-icon">
<img class="icon-eye" src="{% static 'images/img/eye.svg' %}" alt="icon-eye" />
<div class="text-2 text text">סיסמה</div>
</div>
<!-- <div class="text-3 text">שכחתי סיסמה</div> -->
<div class="primary-action-btn">
<div class="text-4 text text">התחברות</div>
</div>
<p class="text-5 text text-14px">עוד לא הצטרפתם אלינו? לחצו כאן</p>
</div>
<img class="illustration-1" src="{% static 'images/img/illu.svg' %}" alt="illustration 1" />
</div>
</div>
</div>
</div>
Could someone please help me make the entire thing fit my screen? What happens now is that the screen has a scrollbar, and you have to scroll to see some of the elements. I want everything to fit in my screen, or any resolution for that matter. In other words, I want the entire thing to "shrink" and fit in any given desktop resolution (not even mobile, just desktop)
Would very much appreciate any help!
Thank you!
Related
I have a problem. In my angular project I have the following code:
.portfolio-summary-container {
display: block;
position: fixed;
bottom: 0;
width: 100%;
height: 80px;
}
.portfolio-summary {
display: inline-flex;
position: relative;
width: 100%;
height: 100%;
}
.portfolio-summary .section {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
border: #c2c2c2 solid 1px;
}
.portfolio-summary .section-operator {
position: absolute;
left: calc(25% - 17px);
margin-top: 23px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
width: 35px;
height: 35px;
border-radius: 50%;
border: #b9b9b9 solid 1px;
color: #808080;
font-size: 1.8rem;
background-color: white;
}
.portfolio-summary .section .price {
font-size: 1.3rem;
font-weight: bold;
}
.portfolio-summary .section .description {
font-size: 1rem;
color: #808080
}
<div class="portfolio-summary-container">
<div class="portfolio-summary" *ngIf="portfolio">
<div class="section">
<div class="price">$10.00</div>
<div class="description">AVAILABLE</div>
</div>
<div class="section-operator">+</div>
<div class="section">
<div class="price">$12.31</div>
<div class="description">TOTAL ALLOCATED </div>
</div>
<div class="section-operator">+</div>
<div class="section">
<div class="price">$0.73</div>
<div class="description">PROFIT</div>
</div>
<div class="section-operator">=</div>
<div class="section">
<div class="price">$23.04</div>
<div class="description">EQUITY</div>
</div>
</div>
</div>
But I am trying to put the <div class="section-operator">+</div> between every section, so it would look like this:
I read that I need to give the parent: position: relative;, so thats why I created the portfolio-summary-container. The container is sticking to the bottom and the inner div has the position: relative; property, but this isn't working for some reason??? How can I get the result from the photo?
You can position each operator separately. I added z-index for the operators to be in the foreground.
.portfolio-summary {
display: inline-flex;
position: fixed;
bottom: 0;
width: 100%;
height: 80px;
}
.portfolio-summary .section {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
border: #c2c2c2 solid 1px;
}
.portfolio-summary .section-operator {
position: absolute;
margin-top: 23px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
width: 35px;
height: 35px;
border-radius: 50%;
border: #b9b9b9 solid 1px;
color: #808080;
font-size: 1.8rem;
background-color: white;
z-index: 2;
}
.portfolio-summary .section .price {
font-size: 1.3rem;
font-weight: bold;
}
.portfolio-summary .section .description {
font-size: 1rem;
color: #808080
}
#op1 {
left: calc(25% - 17px);
}
#op2 {
left: calc(50% - 17px);
}
#op3 {
left: calc(75% - 17px);
}
<div class="portfolio-summary" *ngIf="portfolio">
<div class="section">
<div class="price">$10.00</div>
<div class="description">AVAILABLE</div>
</div>
<div class="section-operator" id="op1">+</div>
<div class="section">
<div class="price">$12.31</div>
<div class="description">TOTAL ALLOCATED </div>
</div>
<div class="section-operator" id="op2">+</div>
<div class="section">
<div class="price">$0.73</div>
<div class="description">PROFIT</div>
</div>
<div class="section-operator" id="op3">=</div>
<div class="section">
<div class="price">$23.04</div>
<div class="description">EQUITY</div>
</div>
</div>
This is my code which works - used vehicle platform - HTML with flex, but isn't quite esthetically pleasing:
body {
font-family: Verdana, sans-serif;
font-size: 16px;
line-height: 18px;
}
header.infog {
background-color: #333;
color: #FFF;
margin-bottom: 25px;
padding: 30px;
}
footer.infog {
background-color: #333;
color: #FFF;
margin-top: 20px;
margin-bottom: 25px;
padding: 10px;
}
.mainwrapper {
border: 2px solid;
display: table;
margin-left: 50px;
width: 900px;
}
.itemwrapper {
display: table-row;
width: 90px;
margin-right: -40px;
}
.itemwrapper1 {
display: table-row;
margin-left: -356em;
width: 100px;
}
.itemwrapper1 img {}
.some-page-wrapper {
margin: 15px;
}
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.column {
margin-left: 40px;
width: 600px;
color: #333;
margin: 0;
display: flex;
flex-direction: column;
flex-basis: 100%;
flex: 1;
padding: 20px;
}
.column1 {
margin-left: 40px;
background-color: blue;
color: #FFF;
margin: 0;
display: flex;
flex-direction: row;
flex-basis: 100%;
flex: 1;
padding: 20px;
}
.priceg {
font-size: 29px;
color: red;
padding-left: 500px;
}
.img-nac img {
max-width: 330px;
}
.img-nac1 img {
max-width: 460px;
}
.ncat {
flex-direction: row;
margin-left: -450px;
text-align: right 50px;
}
.ncat1 {
flex-direction: row;
margin-left: -200px;
text-align: right 50px;
}
.at1 {
white-space: nowrap;
margin-top: -20px;
}
.priceh {
margin-left: 180px;
margin-top: -20px;
}
.mainwrapper {
margin-bottom: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Car , Van, Caravan Dealer | Quality Used Cars</title>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
<header class="infog">
header
</header>
<div class='some-page-wrapper'>
<div class='row'>
<div class='column1'>
2003 TOYOTA RAV4 2.0 GX
</div>
<div class='column1 priceg'>
£8995
</div>
</div>
<div class='row'>
<div class='column img-nac'>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/2013_Toyota_RAV4_XLE_AWD_front_left.jpg/1280px-2013_Toyota_RAV4_XLE_AWD_front_left.jpg">
</div>
<div class='column ncat'>
black
</div>
</div>
</div>
<div class='some-page-wrapper'>
<div class='row'>
<div class='column1'>
2003 TOYOTA RAV4 2.0 GX
</div>
<div class='column1 priceg'>
£8995
</div>
</div>
<div class='row'>
<div class='column img-nac1'>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/2013_Toyota_RAV4_XLE_AWD_front_left.jpg/1280px-2013_Toyota_RAV4_XLE_AWD_front_left.jpg">
</div>
<div class='column ncat'>
rowtt
</div>
</div>
</div>
<div class='some-page-wrapper'>
<div class='row'>
<div class='column img-nac'>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/2013_Toyota_RAV4_XLE_AWD_front_left.jpg/1280px-2013_Toyota_RAV4_XLE_AWD_front_left.jpg">
</div>
<div class='column at1'>
<h3>2004 TOYOTA RAV4 2.0</h4>
black
</div>
<div class='column priceh'>
<h3>£6000</h4>
</div>
</div>
</div>
<footer class="infog">
footer
</footer>
</body>
</html>
The problem is that I'm trying to make it so that if the image is large it's still alongside the text, like this from my page:
The blue line below is actually a bit of the next image... I didn't screencap well.
I've not figured out how to with the CSS and max-width size to do this, resulting in:
The car description in the second flexbox (column and ncat classes) doesn't show up.
But it works fine with the smaller image; I'm trying to make it big enough for people to see.
This isn't the final version, as I'm adding Roboto font etc. in the CSS, but it's almost working.
I'd much appreciate any advice on how to ensure I can get this to work in flexbox.
Just update your CSS with the following code
body {
font-family: Verdana, sans-serif;
font-size: 16px;
line-height: 18px;
}
header.infog {
background-color: #333;
color: #FFF;
margin-bottom: 25px;
padding: 30px;
}
footer.infog {
background-color: #333;
color: #FFF;
margin-top: 20px;
margin-bottom: 25px;
padding: 10px;
}
.mainwrapper {
border: 2px solid;
display: table;
margin-left: 50px;
width: 900px;
}
.itemwrapper {
display: table-row;
width: 90px;
margin-right: -40px;
}
.itemwrapper1 {
display: table-row;
margin-left: -356em;
width: 100px;
}
.some-page-wrapper {
margin: 15px;
}
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.column {
margin-left: 40px;
color: #333;
margin: 0;
display: flex;
flex-direction: column;
padding: 20px;
}
.column1 {
margin-left: 40px;
background-color: blue;
color: #FFF;
margin: 0;
display: flex;
flex-direction: row;
flex-basis: 100%;
flex: 1;
padding: 20px;
}
.priceg {
font-size: 29px;
color: red;
padding-left: 500px;
}
.img-nac img {
max-width: 330px;
}
.img-nac1 img {
max-width: 460px;
}
.ncat {
flex-direction: row;
text-align: right 50px;
}
.ncat1 {
flex-direction: row;
text-align: right 50px;
}
.at1 {
white-space: nowrap;
margin-top: -20px;
}
.priceh {
margin-left: 180px;
margin-top: -20px;
}
.mainwrapper {
margin-bottom: 20px;
}
I had an iframe element inside a div working just fine. I wanted to resize the iframe video but I couldn't centre it, so I added another div to contain both the div and the iframe. And after doing this, you couldn't click the video anymore.
Here's the chunk of code regarding this problem. As you will see, I already tried setting z-index values and pointer-events: none;.
#botNavBar {
height: auto;
padding-top: 50px;
padding-bottom: 100px;
padding-left: 150px;
padding-right: 150px;
position: relative;
background: black;
display: flex;
flex-direction: column;
z-index: -1;
align-items: center;
}
#videoResizer {
width: 60%;
z-index: 2;
pointer-events: none;
}
#videoContainer {
width: 100%;
position: relative;
padding-bottom: 56.25%;
align-items: center;
justify-content: center;
text-align: center;
z-index: 2;
pointer-events: none;
}
#trailerTwogether {
position: absolute;
display: block;
width: 100%;
height: 100%;
border-style: none;
z-index: 200000000000000;
}
#leftSide {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
#contactInfo {
Font-Family: 'Raleway', Sans-Serif;
Font-Size: 16px;
color: rgb(214, 234, 248);
margin-bottom: 0px;
padding-top: 50px;
}
#contactMail {
Font-Family: 'Raleway', Sans-Serif;
Font-Size: 16px;
color: darkmagenta;
margin-bottom: 0px;
padding-top: 0px;
margin-top: 0px;
}
<div id="botNavBar">
<div id="videoResizer">
<div id="videoContainer">
<iframe id="trailerTwogether" src="https://www.youtube.com/embed/7VjyXe_d57E"> </iframe>
</div>
</div>
<div id="leftSide">
<p id=contactInfo>
Desarrollado por <b>Flaming Llama Games</b> para <b>PS4</b>
<br>
Lanzamiento: finales <b>2021</b>
</p>
<p id="contactMail">
contacto#flamingllamagames.com
</p>
</div>
</div>
https://jsfiddle.net/Als3rr/e7kqv4wd/
I removed the styles by adding 1 in id in all 3 divs of iframe.
I have added inline style for iframe
I have added "padding-top:100px;" for #leftSide
It worked fine [https://i.stack.imgur.com/O9BUt.png][1]
#leftSide {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
padding-top:100px;
}
<div id="botNavBar1">
<div id="videoResizer1">
<div id="videoContainer1">
<iframe id="trailerTwogether" src="https://www.youtube.com/embed/7VjyXe_d57E" style="height:20%; width:20%"> </iframe>
</div>
</div>
<div id="leftSide">
<p id=contactInfo>
Desarrollado por <b>Flaming Llama Games</b> para <b>PS4</b>
<br>
Lanzamiento: finales <b>2021</b>
</p>
<p id="contactMail">
contacto#flamingllamagames.com
</p>
</div>
</div>
The main issue is that you have a z-index: -1; on the top level element (#botNavBar). This puts this div "behind" the body.
Also the pointer-events: none; you have added in an attempt to solve the issue are unfortunately causing it in another way, so those also need to be removed.
Other small issues:
Font-Family and Font-Size should be all lower-case
This snippet won't display the issue here as the iframe is blocked inside a StackOverflow snippet, but it will work in a real enviroment.
#botNavBar {
height: auto;
padding-top: 50px;
padding-bottom: 100px;
padding-left: 150px;
padding-right: 150px;
position: relative;
background: black;
display: flex;
flex-direction: column;
align-items: center;
}
#videoResizer {
width: 60%;
z-index: 2;
}
#videoContainer {
width: 100%;
position: relative;
padding-bottom: 56.25%;
align-items: center;
justify-content: center;
text-align: center;
z-index: 2;
}
#trailerTwogether {
position: absolute;
display: block;
width: 100%;
height: 100%;
border-style: none;
z-index: 200000000000000;
}
#leftSide {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
#contactInfo {
font-family: 'Raleway', Sans-Serif;
font-size: 16px;
color: rgb(214, 234, 248);
margin-bottom: 0px;
padding-top: 50px;
}
#contactMail {
font-family: 'Raleway', Sans-Serif;
font-size: 16px;
color: darkmagenta;
margin-bottom: 0px;
padding-top: 0px;
margin-top: 0px;
}
<div id="botNavBar">
<div id="videoResizer">
<div id="videoContainer">
<iframe id="trailerTwogether" src="https://www.youtube.com/embed/7VjyXe_d57E"> </iframe>
</div>
</div>
<div id="leftSide">
<p id=contactInfo>
Desarrollado por <b>Flaming Llama Games</b> para <b>PS4</b>
<br> Lanzamiento: finales <b>2021</b>
</p>
<p id="contactMail">
contacto#flamingllamagames.com
</p>
</div>
</div>
I'm trying to create a scrolling element without a fixed height parent. I want #SECTION1 of my code to be scrollable to show the rest of the images. I can't seem to find a way to do this. I've attempted to set #SECTION1 to a fixed height but it forces my images to be squashed. Any help would be appreciated. Thank you.
Here is my code:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
text-decoration: none;
}
::-webkit-scrollbar {
width: 15px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}
html,
body {
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
}
/*----------SECTION 1----------*/
header {
height: 80px;
background-color: black;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
#header-wrapper {
display: flex;
width: 55%;
justify-content: space-between;
align-items: center;
}
#logo {
width: 70px;
}
nav a {
color: white;
padding: 20px;
font-family: 'Roboto';
font-size: 0.8em;
font-weight: bold;
}
#media only screen and (max-width: 750px) {
nav {
display: none;
}
}
#mobile-menu {
color: white;
font-size: 1.3em;
}
#media only screen and (min-width: 750px) {
#mobile-menu {
display: none;
}
}
#body-wrapper {
display: flex;
height: 100%;
}
aside {
width: 300px;
height: 889px;
background-color: #0c0c0c;
display: flex;
align-items: center;
padding-top: 50px;
flex-direction: column;
}
#aside-wrap {
width: 70%;
}
#user-info {
display: flex;
margin: 10px;
margin-left: 0;
margin-bottom: 50px;
justify-content: center;
align-items: center;
font-family: 'Roboto';
font-weight: 400;
}
#user {
font-size: 40px;
color: white;
margin-right: 20px;
}
aside h3 {
color: white;
font-size: 1.2em;
}
#hello {
color: white;
font-size: 20px;
}
#box-1 {
color: #808080;
margin-bottom: 60px;
}
#box-1 p {
margin: 20px;
margin-left: 0;
font-family: 'Roboto';
font-size: 0.9em;
}
#box-2 {
color: #808080;
}
#box-2 p {
margin: 20px;
margin-left: 0;
font-family: 'Roboto';
font-size: 0.9em;
}
#section1 {
background-color: #191919;
/*background: linear-gradient(rgba(0,0,0,0.3),rgba(0,0,0,0.3)),
url("listen_background.jpg");*/
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100%;
overflow: auto;
}
#section1-wrapper {
width: 80%;
display: flex;
font-family: 'Roboto';
padding-top: 50px;
padding-bottom: 50px;
align-items: center;
flex-direction: column;
}
#section1 h1 {
color: white;
font-size: 3em;
margin-bottom: 50px;
text-align: center;
}
.image-box {
max-width: 280px;
margin: 20px;
}
img {
max-width: 100%;
}
#image-row-1,
#image-row-2,
#image-row-3,
#image-row-4 {
width: 100%;
margin-bottom: 50px;
display: flex;
justify-content: space-between;
}
#media only screen and (max-width: 1080px) {
#image-row-1,
#image-row-2,
#image-row-3,
#image-row-4 {
flex-direction: column;
align-items: center;
}
}
/*----------------SECTION 2--------------*/
#pusher {
height: 889px;
width: 300px;
}
#player {
height: 80px;
width: 100%;
position: fixed;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: black;
}
#media only screen and (max-width: 750px) {
#player {
height: auto;
}
}
#player-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
width: 80%;
}
#media only screen and (max-width: 750px) {
#player-wrapper {
flex-direction: column;
}
}
.button-controls {
color: white;
margin: 20px;
}
#player-bar {
width: 100%;
height: 3px;
background-color: white;
}
#player-filler {
width: 50%;
height: 100%;
background-color: #2A4B5A;
}
#timeline {
width: 50%;
display: flex;
justify-content: center;
align-items: center;
}
#media only screen and (max-width: 750px) {
#timeline {
width: 100%;
}
}
#timeline p {
color: white;
margin: 20px;
}
#share,
#phone {
color: white;
margin: 20px;
}
#media only screen and (max-width: 750px) {
#share,
#phone {
display: none;
}
}
<head>
<meta charset="utf-8">
<title>Flo Music</title>
<link rel="stylesheet" type="text/css" href="listen.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
</head>
<body>
<div id="test">
<div id="body-wrapper">
<aside>
<div id="aside-wrap">
<div id="user-info">
<i class="far fa-user-circle" id="user"></i>
<h3>Emmanuel</h3>
</div>
<div id="box-1">
<p>Your Library</p>
<p>Recently Played</p>
<p>Songs</p>
<p>Playlist</p>
</div>
<div id="box-2">
<p>Your Library</p>
<p>Recently Played</p>
<p>Songs</p>
<p>Playlist</p>
</div>
<p>HOME</p>
</div>
</aside>
<section id="section1">
<div id="section1-wrapper">
<h1>New Releases</h1>
<div id="image-row-1">
<div class="image-box"><img src="album1.jpg"></div>
<div class="image-box"><img src="album2.jpg"></div>
<div class="image-box"><img src="album3.jpg"></div>
<div class="image-box"><img src="album4.jpg"></div>
</div>
<div id="image-row-2">
<div class="image-box"><img src="album5.jpg"></div>
<div class="image-box"><img src="album6.jpg"></div>
<div class="image-box"><img src="album7.jpg"></div>
<div class="image-box"><img src="album8.png"></div>
</div>
<div id="image-row-3">
<div class="image-box"><img src="album9.jpg"></div>
<div class="image-box"><img src="album10.jpg"></div>
<div class="image-box"><img src="album11.jpg"></div>
<div class="image-box"><img src="album12.jpg"></div>
</div>
<div id="image-row-4">
<div class="image-box"><img src="album13.jpg"></div>
<div class="image-box"><img src="album14.jpg"></div>
<div class="image-box"><img src="album15.jpg"></div>
<div class="image-box"><img src="album16.jpg"></div>
</div>
</div>
</section>
</div>
<div id="player">
<div id="player-wrapper">
<div id="controls">
<i class="fas fa-backward button-controls"></i>
<i class="fas fa-play button-controls"></i>
<i class="fas fa-forward button-controls"></i>
</div>
<div id="timeline">
<p>0:00</p>
<div id="player-bar">
<div id="player-filler"></div>
</div>
<p>0:00</p>
</div>
<div id="icon-right">
<i class="fas fa-share-square" id="share"></i>
<i class="fas fa-mobile" id="phone"></i>
</div>
Flex items are set to flex-shrink: 1 by default. This means they can shrink to prevent an overflow of the container. In your case, you may need to disable this feature (flex-shrink: 0).
Also, consider using height: 100vh, instead of height: 100% on your flex container. Percentage heights are tricky and often require the parent to have a defined height.
See this post for details: Working with the CSS height property and percentage values
Lastly, remove justify-content: center from your flex container. It makes content inaccessible via scroll in some cases.
See this post for details: Can't scroll to top of flex item that is overflowing container
Make these adjustments to your code:
#body-wrapper {
display: flex;
/* height: 100%; */
height: calc(100vh - 80px); /* subtract footer height */
}
#section1 {
background-color: #191919;
display: flex;
align-items: center;
/* justify-content: center; */ /* remove to avoid scrolling problems */
flex-direction: column;
width: 100%;
overflow: auto;
}
#section1-wrapper {
width: 80%;
display: flex;
font-family: 'Roboto';
padding-top: 50px;
padding-bottom: 50px;
align-items: center;
flex-direction: column;
flex-shrink: 0; /* add to disable flex default shrinking feature */
}
jsFiddle demo
You should change your overflow property in the #section1
#section1-wrapper {
overflow: scroll;
}
so I'm trying to do a "cast" section for one of my assignments and I want the actor's character to appear when the actor is hovered over. How would I achieve this? When hiding the display of the deadpool div, it leaves a big gap in the page. I want this to not show until Ryan Reynolds is hovered over.
article {
display: flex;
flex-wrap: wrap;
margin: auto;
padding-top: 12px;
padding-bottom: 12px;
background-color: #8b2323;
width: 48vw;
min-height: 200px;
min-width: 391px;
font-family: verdana, sans-serif;
justify-content: center;
}
.castcontainer {
flex-wrap: wrap;
min-width: 215px;
width: 20%;
height: 30%;
overflow: hidden;
padding: 5px;
}
#cast {
border-radius: 50%;
width: 100%;
}
.cast2 {
display: none;
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
.cast:hover+.cast2 {
display: block;
}
.cast {
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
p {
background: white;
}
<article>
<div class="castcontainer">
<div class="cast">
<img src="https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg" id="cast">
<p><b>Ryan Reynalds</b></p>
</div>
</div>
<div class="castcontainer">
<div class="cast2">
<img src="http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg" id="cast">
<p><b>Wade Wilson</b></p>
</div>
</div>
</article>
Let me offer a more radical departure from your current code:
.cast * {
box-sizing: border-box;
}
.cast {
border-radius: 10px;
background: #8b2323;
font-family: Verdana, sans-serif;
text-align: center;
padding: 12px;
}
.cast img {
border-radius: 50%;
max-height: 300px;
}
.cast strong {
background: white;
display: block;
border-radius: 10px;
margin-top: 5px;
}
.cast .actor,
.cast .role {
width: 100%;
}
.cast .actor {
display: block;
z-index: 2;
}
.cast .role {
display: none;
z-index: 1;
}
.cast:hover .actor {
display: none;
}
.cast:hover .role {
display: block;
}
<article class="cast">
<div class="actor">
<img src="https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg">
<strong>Ryan Reynalds</strong>
</div>
<div class="role">
<img src="http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg">
<strong>Wade Wilson</strong>
</div>
</article>
This reduces the number of child elements and (in my opinion) makes selecting which element to show/hide that much easier. You're targeting the :hover event of the parent wrapper and instead of trying to use an ID (which cannot be reused) you're targeting .actor and .role.
One concern would be to make sure that the images for each were the same dimension, otherwise on change you could get some transition that was unappealing if the box had to resize.
Might this be what you're looking to do?
Added:
article:hover .cast {
display: none;
}
article:hover .cast2 {
display: block;
}
article {
display: flex;
flex-wrap: wrap;
margin: auto;
padding-top: 12px;
padding-bottom: 12px;
background-color: #8b2323;
width: 48vw;
min-height: 200px;
min-width: 391px;
font-family: verdana, sans-serif;
justify-content: center;
}
article:hover .cast {
display: none;
}
article:hover .cast2 {
display: block;
}
.castcontainer {
flex-wrap: wrap;
min-width: 215px;
width: 20%;
height: 30%;
overflow: hidden;
padding: 5px;
}
#cast {
border-radius: 50%;
width: 100%;
}
.cast2 {
display: none;
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
.cast:hover+.cast2 {
display: block;
}
.cast {
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
p {
background: white;
}
<article>
<div id="one" class="castcontainer">
<div class="cast">
<img src="https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg" id="cast">
<p><b>Ryan Reynalds</b></p>
</div>
</div>
<div id="two"class="castcontainer">
<div class="cast2">
<img src="http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg" id="cast">
<p><b>Wade Wilson</b></p>
</div>
</div>
</article>
<article>
<div class="castcontainer" id="show1">
<div class="cast">
<img src="https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg" class="castImg" id="CastImgRef">
<p><b>Ryan Reynalds</b></p>
</div>
</div>
<div class="castcontainer" id="show2">
<div class="cast2">
<img src="http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg" class="castImg">
<p><b>Wade Wilson</b></p>
</div>
</div>
</article>
jQuery(function ($) {
$('#show1').hover(function () {
$(this).find('img').attr('src', function (i, src) {
return src.replace('https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg', 'http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg')
})
$('#textChange').text('Wade Wilson');
}, function () {
$(this).find('img').attr('src', function (i, src) {
return src.replace('http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg', 'https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg')
})
$('#textChange').text('Ryan Reynalds');
})
})
Add thisjquery and it will work fine
https://jsfiddle.net/dLwxm2ox/8/
article {
display: flex;
flex-wrap: wrap;
margin: auto;
padding-top: 12px;
padding-bottom: 12px;
background-color: #8b2323;
width: 48vw;
min-height: 200px;
min-width: 391px;
font-family: verdana, sans-serif;
justify-content: center;
}
article:hover .cast {
display: none;
}
article:hover .cast2 {
display: block;
}
.castcontainer {
flex-wrap: wrap;
min-width: 215px;
width: 20%;
height: 30%;
overflow: hidden;
padding: 5px;
}
#cast {
border-radius: 50%;
width: 100%;
}
.cast2 {
display: none;
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
.cast:hover+.cast2 {
display: block;
}
.cast {
text-align: center;
background-color: #8b1a1a;
border-radius: 10px;
padding: 10px;
}
p {
background: white;
}
<article>
<div id="one" class="castcontainer cast">
<img src="https://pbs.twimg.com/profile_images/741703039355064320/ClVbjlG-.jpg" id="cast">
<p><b>Ryan Reynalds</b></p>
</div>
<div id="two"class="castcontainer cast2">
<img src="http://cdn03.cdn.justjared.com/wp-content/uploads/headlines/2017/08/joi-harris-rip.jpg" id="cast">
<p><b>Wade Wilson</b></p>
</div>
</article>
The inner div seems to be unnecessary where class="cast" and class="cast2". Remove the div's and add the class to its parent.