HTML CSS Image Overflow issue - html

I am having an issue with scrollable images that shouldn't be scrollable. I thought that overflow: hidden; should fix that issue, but as of yet no dice.
Below is just a snippet from my code. In my code, there are 4 "a" elements within the wrapper class.
HTML
<a href="Link to other page">
<div class="container">
<img class="image" src="image.jpg">
<div class="overlay"></div>
<div class="overlay2"></div>
<div class="overlayText">Title</div>
</div>
</a>
CSS
.wrapper {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: 55vh;
grid-auto-columns: 41vw;
background-color: #eef7e4;
gap: 1vh;
padding-left: 1vh;
padding-right: 1vh;
overflow: hidden;
}
.container {
align-items: center;
display: flex;
position: relative;
overflow: hidden;
}
.image {
overflow: hidden;
}
.overlay {
position: absolute;
width: 0;
height: 100%;
background-color: #e32827;
opacity: 80%;
transition: 0.7s ease;
z-index: 2;
overflow: hidden;
}
.overlay2 {
position: absolute;
width: 0;
height: 100%;
background-color: #eef7e4;
opacity: 80%;
transition: 0.5s ease;
overflow: hidden;
}
.overlayText {
position: absolute;
width: 50%;
height: 100%;
opacity: 0;
color: #eef7e4;
transition: 0.6s ease;
text-align: center;
margin-top: 50vh;
z-index: 3;
overflow: hidden;
}
As you can see by the CSS above, the thought of overflow: hidden; was not working for me. I'm fairly new to webpage design, and after looking through a lot online, the only fix that I found was overflow: hidden; which as stated above isn't working here.
Thank you guys for the help!

Found the problem, I needed to give .container a width & height
.container {
align-items: center;
display: flex;
position: relative;
width: 100%;
height: 100%;
}

give your image width & height .image {height: 100vh;width: 100vw;}

Related

Hover effect on PNG image

When I hover my mouse on the background of the image, the 3D effect triggers, but when I move over the girl image area, it doesn't trigger anymore. The transparent image is overlaying the background. How do I make it triggers when the mouse is over the girl image?
See what I did on JSFIDDLE
HTML -
<div class="test-imgplace">
<img src="https://christianluneborg.com/imgs/test-woman.png" class="imgtest">
<div class="card-hover">
<div class="card">
<div class="card-content">
<div class="image" style="background-image: url(https://christianluneborg.com/imgs/test-woman-bg.png);"></div>
</div>
</div>
</div>
</div>
CSS -
.card .image{
height: 275px;
width: 183px;
background-size: cover;
background-position: center center;
}
.imgtest {
position: absolute;
z-index: 1;
text-align: center;
top: 0;
left: 100px;
border: solid 1px;
}
.test-imgplace {
margin: 0 auto;
position: relative;
overflow: hidden;
}
.card .text{
height: 20%;
margin: 0;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
font-size: 50px;
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
}
.card{
width: 183px;
height: 275px;
margin: auto auto;
background: #383030;
border-radius: 5px;
overflow: hidden;
text-align: center;
}
.card-content{
transform-style: preserve-3d;
}
body{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.hover-in{
transition: .3s ease-out;
}
.hover-out{
transition: .3s ease-in;
}
.card-hover{
margin:0;
}
When the mouse hovers over the semi-transparent image, it causes mouse events to go there instead of the script that is applying the 3D effect.
This is easy to fix - just add pointer-events: none; to .imgtest. JSFiddle of the fix

Flexbox stops working properly after adding additional div

I wanna make a simple responsive site with 3 images in-front of a background, each of them a button that gets overlayed when you hover it. The problem is when I add the additional containers in order to do the image hover overlays, justify-content and row-wrap stop working as they should and they no longer center the images properly. If I remove all the container divs everything goes back to normal.
.background {
display: inline-block;
position: relative;
min-width: 100%;
max-width: 100%;
height: 100%;
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.mountain {
pointer-events: none;
position: absolute;
width: 100%;
min-height: 100%;
z-index: -1;
}
.tabs {
display: flex;
justify-content: space-between;
align-content: space-between;
flex-flow: row wrap;
gap: 10px;
padding-top: 200px;
}
.container1 {
position: relative;
left: 80px;
}
.container1:hover .portraits {
opacity: 0.5;
}
.portraits {
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
.container2 {
position: relative;
width: 480px;
max-height: 100%;
}
.container2:hover .secondtab {
opacity: 0.5;
}
.secondtab {
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
.container3 {
position: relative;
margin-right: 80px;
;
}
.container3:hover .thirdtab {
opacity: 0.5;
}
.thirdtab {
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
<div class="background">
<img class="mountain" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864">
<div class="buttons">
<button class="Contacts">CONTACTS</button>
<button class="Aboutme">ABOUT ME</button>
<section class="tabs">
<div class="container1">
<input class="portraits" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
<div class="container2">
<input class="secondtab" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
<div class="container3">
<input class="thirdtab" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
</section>
Change space-between to space-around on your .tabs class. Then, remove any values you have set on your flex items. For example, I removed the left: 80px value you had set on container1 and removed the margin-right from container3.
Setting those values are being counterproductive to the flexbox as you are instructing the browser to position those containers in a relatively static position within the parent. This will be much more responsive if you allow flex do its job.
.background {
display: inline-block;
position: relative;
min-width: 100%;
max-width: 100%;
height: 100%;
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.mountain {
pointer-events: none;
position: absolute;
width: 100%;
min-height: 100%;
z-index: -1;
}
.tabs {
display: flex;
justify-content: space-around;
align-content: space-between;
flex-flow: row wrap;
padding-top: 200px;
}
.container1 {
display: flex;
position: relative;
}
.container1:hover .portraits {
opacity: 0.5;
}
.portraits {
display: flex;
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
.container2 {
display: flex;
position: relative;
width: 480px;
max-height: 100%;
}
.container2:hover .secondtab {
opacity: 0.5;
}
.secondtab {
display: flex;
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
.container3 {
display: flex;
position: relative;
}
.container3:hover .thirdtab {
opacity: 0.5;
}
.thirdtab {
display: flex;
margin: auto;
max-width: 100%;
opacity: 1;
transition: .5s ease;
backface-visibility: hidden;
width: 480px;
max-height: 100%;
}
<div class="background">
<img class="mountain" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864">
<div class="buttons">
<button class="Contacts">CONTACTS</button>
<button class="Aboutme">ABOUT ME</button>
</div>
<section class="tabs">
<div class="container1">
<input class="portraits" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
<div class="container2">
<input class="secondtab" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
<div class="container3">
<input class="thirdtab" type="image" src="https://scontent.fsof8-1.fna.fbcdn.net/v/t1.15752-9/248678344_166048722401558_3753835307514045389_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ae9488&_nc_ohc=hMjalJL0QVMAX8jUsDI&_nc_ht=scontent.fsof8-1.fna&oh=03_AVLASJWuh-jugLUe4XS8djFYOc8Ps3PK3bA8Ue4D9zHEMg&oe=62801864"
/>
</div>
</section>
</div>
Edit ~ If you don't want the images to wrap, remove all the static (fixed) widths and use this:
.container1,
.container2,
.container3 {
width: calc(100%/3);
}

Border Radius not working on wider screen

I'm learning from a project which uses cards with border-radius 50px. However, on wider screen, the border is not working. It's a quite simple code, bud I don't understand why this is happening
Can you help me?
<div class="panel panel1" style="background-image: url('https://images.unsplash.com/photo-1448375240586-882707db888b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8Zm9yZXN0fGVufDB8fDB8fA%3D%3D&w=1000&q=80')">
<h3>Explore the world</h3>
</div>
body {
font-family: 'Muli', sans-serif;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
}
.container {
display: flex;
width: 90vw;
overflow: hidden;
}
.panel {
background-size: auto 100%;
background-position: center;
background-repeat: no-repeat;
height: 80vh;
border-radius: 50px;
color: white;
cursor: pointer;
flex: 0.2;
margin: 15px;
position: relative;
transition: flex 0.7s ease-in;
overflow: hidden;
}
.panel h3 {
font-size: 24px;
position: absolute;
bottom: 60px;
left: 200px;
margin: 0;
opacity: 0;
}
.panel.active {
flex: 2;
overflow: hidden;
}
Border radius not working
looking at the print screen it looks like the border radius is working, but the div is being cut, maybe you can solve this by adding a width to the panel

Unable to execute a CSS transform. Can someone see and help me out?

I am very new to the whole of CSS and web development. I have been learning by looking at the examples on W3 and Codepen. I have prepared a flexbox inside swipeable slides. I want each card to be zoomed in and show a description. I am also putting the links here.. can someone please explain where I went wrong?
Here's is my code
I want a translazeZ transform on each tab in my flexbox. I want each tab to be expanded as a larger section.
This is an example
.card{
display: flex;
flex-wrap: wrap;
flex-grow: 4;
font-size: 22px;
padding: 25px;
margin: 15px;
color: white;
border-radius: 5px;
background: blue;
transform-style: preserve-3d;
transition: transform 0.5s;
justify-content: center;
align-content: center;
}
.card div {
position: absolute;
width: 100%;
height: 100%;
border-radius: 6px;
background: blue;
display: flex;
justify-content: center;
transform-style: preserve-3d;
align-items: center;
transition: 1s;
color: white;
}
.card .des {
display: none;
}
.card.flipped {
transform: translateZ(100px);
}
I think this is what you want, but you have to wrap the description in an element (for example 'span') and that again in an container (for example 'div') for centering with flex, since toggle() does display: block;.
$('.container').on('click', function() {
$('.card').toggleClass('flipped');
$('.des').toggle();
});
.container {
position: relative;
width: 300px;
height: 200px;
perspective: 800px;
}
.card {
display: flex;
flex-wrap: wrap;
flex-grow: 4;
justify-content: center;
align-content: center;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.5s;
padding: 25px;
margin: 15px;
border-radius: 5px;
font-size: 22px;
background: blue;
color: white;
}
.card div {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: transform 1s;
border-radius: 6px;
background: blue;
color: white;
}
.card .des {
display: none;
}
.card.flipped {
transform: translateZ(100px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<div class="card">
<div>
<h5>Integration</h5><br>
<div class="des">
<div>
<span>Description, Yo, what up?</span>
</div>
</div>
</div>
</div>
</div>
You should take a look at the transform: scale property. I think this is what you need ;)
https://developer.mozilla.org/fr/docs/Web/CSS/transform-function/scale()
transform: scale(2); /* --> Gives you the double resized of normal item*/

CSS padding top div modify the below div

I've been working on an Angular plugin that uses a template. My goal is to add more padding-top to the section "loader-wrap", but when I do this, the second div called "message-wrap" is modified and moved as well.
I need add padding-top: 100px to 'loader-wrap' without moving down 'message-wrap' along with it. How do I fix this?
Basic Structure HTML
<div id="page-wrap">
<section id="loader-wrap"></section>
<section id="message-wrap"></section>
</div>
CSS
gp-splash-loader #page-wrap {
z-index: 999;
position: fixed;
background: #FFFFFF;
width: 100%;
height: 80%;
top: 10%;
margin: 0 auto;
-webkit-transition: opacity .5s;
-moz-transition: opacity .5s;
transition: opacity .5s;
-webkit-backface-visibility: hidden;
}
#media ( max-height: 735px) {
gp-splash-loader #page-wrap.opened{
height: 100%;
top: 0;
};
}
gp-splash-loader #page-wrap.closed {
opacity: 0;
}
gp-splash-loader #page-wrap.opened {
opacity: 1;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 0.5s;
}
gp-splash-loader #loader-wrap {
width: 30%;
height: 70%;
min-width: 300px;
max-width: 600px;
margin: 10px auto;
padding-top: 50px;
}
gp-splash-loader #message-wrap {
min-width: 1px;
margin: 0 auto;
height: 30%;
min-height: 30%;
}
gp-splash-loader #header-wrap {
display: inline-block;
}
check in codepen: http://codepen.io/gpincheiraa/pen/obdXEx
Here's the deal. You can't move that loader down with padding, otherwise it will affect the message. you need a different solution. try the below html/css.
Basically I set it up so the loader and the message are in a div that will be centered. then inside of that centered div, you can do whatever you want. But the loader and message will be in the middle
if you want only the loader to be centered, then you can take the message out of the 'loader-message-box' div, and apply different styles to it. I'll work up a another fiddle for that solution
https://jsfiddle.net/ahmadabdul3/huf5zjkv/ - both message and loader are centered
https://jsfiddle.net/ahmadabdul3/huf5zjkv/1/ - this one will keep the message on the bottom
code:
html
<div class='loader-message-box'>
<div class='loader-message'>
<div class='loader'>
</div>
<div class='message'>
Message
</div>
</div>
<div class='vertical-mid-hack'>
</div>
</div>
css
body, html {
height: 100%;
margin: 0;
}
.loader-message-box {
width: 100%;
height: 100%;
text-align: center;
}
.loader-message {
display: inline-block;
vertical-align: middle;
margin: 0 -2px;
}
.vertical-mid-hack {
display: inline-block;
vertical-align: middle;
margin: 0 -2px;
height: 100%;
}
.loader {
width: 100px;
height: 100px;
background-color: teal;
border-radius: 100px;
margin: 0 auto;
margin-bottom: 20px;
}
.message {
background-color: white;
border-radius: 3px;
font-family: arial;
padding: 20px 0;
margin: 0 auto;
margin-top: 20px:
}
I removed any instance of gp-splash-loader from CSS. I don't know ng but I do know gp-splash-loader is not a valid selector. Other than that, the following CSS is the important part:
CSS:
body {
margin: 0;
padding: 0;
background: slateblue;
text-align: center;
top: 0;
position: relative;
}
#loader-wrap {
width: 30%;
height: 70%;
min-width: 300px;
max-width: 600px;
margin: 10px auto;
padding-top: 100px;
position: relative;
z-index: 10;
}
#message-wrap {
min-width: 1px;
margin: 0 auto;
height: 30%;
min-height: 30%;
position: relative;
z-index: 11;
}
Added 50px padding-top
Positioned both relative (and body as well)
Made sure that one never touches the other by using different z-index
http://codepen.io/zer00ne/full/qbYMMQ/
BTW, if you want to adjust either section up or down, add top and a negative value if you want the section to go up and vice versa. ex.
#message-wrap {
min-width: 1px;
margin: 0 auto;
height: 30%;
min-height: 30%;
position: relative;
z-index: 11;
top: -100px;
}
That should place #message-wrap 100px higher.