I am trying to create a netflix type scroll bar but the problem is that my images can scroll up and down instead of side to side. Like this.
look at bottom
I want it to go side to side
here is my css snippet
.movies {
background-color: lightblue;
border: 1px solid black;
background-color: lightblue;
border: 1px solid black;
height: 15rem;
width: 100%;
overflow-x: scroll;
}
.sinmovie {
height: 10rem;
width: 15rem;
}
.movies-div {
position: absolute;
margin-top: 45rem;
height: 3rem;
}
here is my html
<div class="movies-div">
<h1 class="movies-heading">Movies preview</h1>
<div class="movies">
<img class="sinmovie" src="./movies/large-movie1.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie2.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie3.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie5.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie6.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie8.jpg" alt="">
<img class="sinmovie" src="/movies/large-movie7.jpg" alt="">
</div>
</div>
It may be a problem with my whole code
if you dont want to see if you know whats wrong skip!
here is my css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--maincolor: #124E78;
--divcolor: #F0F0C9;
--divcolortwo: #6E0E0A;
---seccondcolor: #F2BB05;
---thirdcolor: #D74E09;
}
body {
background-color: var(--maincolor);
}
.nav-bar {
background-color: var(---seccondcolor);
display: flex;
font-size: 2rem;
font-family: Gulzar;
border: solid 3px black;
height: 6rem;
border-bottom: 5px solid black;
z-index: 1;
}
ul {
display: flex;
list-style: none;
column-gap: 7rem;
padding-left: 20rem;
}
li {
border: solid 2px black;
width: 150px;
height: 50px;
justify-content: center;
align-items: center;
box-sizing: content-box;
text-align: center;
margin-top: 7px;
padding-bottom: 20px;
overflow: visible;
-webkit-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
}
.nav-bar:hover {
transform: scale(1.01);
background-color: white;
-webkit-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
}
li:hover {
transform: scale(1.1);
background-color: var(---seccondcolor);
transition-duration: 0.5s;
}
.first-page-look {
background: url(./images/movie-background.webp);
height: 43rem;
width: 100%;
background-size: cover;
border: 4px solid black;
border-right: solid black 10px;
border-left: solid black 10px;
position: absolute;
}
.first-page-look:hover {
transform: scale(1.01);
background-image: url("./images/movie-background.webp"), linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5));
background-blend-mode: overlay;
}
a {
text-decoration: none;
font-family: Splash;
font-size: 1.2rem;
text-align: center;
text-transform: capitalize;
}
#main-page-button {
background-color: #6E0E0A;
position: absolute;
bottom: 10px;
font-size: 1rem;
width: 12rem;
height: 3rem;
margin-bottom: 4rem;
margin-left: 2rem;
color: white;
-webkit-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
}
#main-page-button:hover {
transform: scale(1.1);
background-color: black;
}
.main-page-par {
font: BebasNeue-Regular;
color: white;
position: absolute;
bottom: 200px;
margin-left: 3rem;
font-size: 1.5rem;
background-color: rgba(0, 0, 0, 0.5);
padding: 7px;
padding-left: 10px;
padding-right: 10px;
border-radius: 20px;
-webkit-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
}
.main-page-par:hover {
transform: scale(1.1);
}
#our-part-but {
background-color: #6E0E0A;
position: absolute;
bottom: 10px;
font-size: 1rem;
width: 12rem;
height: 3rem;
margin-bottom: 4rem;
margin-left: 15rem;
color: white;
-webkit-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
box-shadow: 8px 13px 18px 5px rgba(0, 0, 0, 0.75);
}
#our-part-but:hover {
transform: scale(1.1);
background-color: black;
}
.movies {
background-color: lightblue;
border: 1px solid black;
background-color: lightblue;
border: 1px solid black;
height: 15rem;
width: 100%;
overflow-x: scroll;
}
.sinmovie {
height: 10rem;
width: 15rem;
}
.movies-div {
position: absolute;
margin-top: 45rem;
height: 3rem;
}
pls help
the suggested addition of display flex to .movies creates this
look at bottom it creates it unnsesarily long page at bottom
you can use scroll-snap:
<style>
.movies {
width: 600px;
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.movies > div {
width: 200px;
flex-shrink: 0;
box-sizing: border-box;
padding: 10px;
scroll-snap-align: start;
}
.movies > div img {
width: 100%;
}
</style>
<div class="movies-div">
<h1 class="movies-heading">Movies preview</h1>
<div class="movies">
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
<div>
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face/cpWUtkcgRKeauhTyVMjYHxAutp4.jpg" alt="">
</div>
</div>
</div>
Related
I've made this model using six div's inside a container div. It works fine just as it is, but I would need to make it responsive to be compliant with WCAG 2.1. I've tried to use flexbox and grid but don't really figure out what would be the best way to achieve responsiveness on the model. I would only need one break point which puts all the divs on on column with the main topi on the top and the sub topics in descending order like the examples I made in powerpoint:
This is my code:
.container {
display: relative;
width: 700px;
height: 400px;
background-color: #BEE5F4;
}
.subTopics {
width: 250px;
height: 100px;
background: #94D9F2;
color: #000000;
font-weight: 700;
font-size: large;
}
p {
padding: 10px;
}
#subTopic1 {
position: absolute;
left: 25px;
top: 50px;
}
#subTopic2 {
position: absolute;
left: 425px;
top: 50px;
text-align: right;
}
#subTopic3 {
position: absolute;
left: 25px;
top: 250px;
}
#subTopic4 {
position: absolute;
left: 425px;
top: 250px;
text-align: right;
}
#mainTopic {
width: 250px;
height: 250px;
border-radius: 50% 50% 50% 50%;
border: solid 1px rgb(255, 255, 255);
background-color: #ffffff;
position: absolute;
left: 225px;
top: 75px;
text-align: center;
color: #000000;
font-weight: 700;
position: absolute;
overflow: hidden;
}
.tittel {
color: rgb(0, 0, 0);
position: relative;
top: 40px;
font-size: xx-large;
text-align: center;
color: #000000;
font-weight: 700;
}
.circeBack {
width: 290px;
height: 290px;
border-radius: 50% 50% 50% 50%;
background-color: #BEE5F4;
position: absolute;
left: 205px;
top: 55px;
}
a {
text-decoration: none;
color: #000000;
}
#mainTopic:hover {
background-color: rgb(255, 255, 255);
box-shadow: 2px 2px 22px 2px #94D9F2;
-webkit-box-shadow: 1px 1px 21px 1px #94D9F2;
-moz-box-shadow: 1px 1px 21px 1px #94D9F2;
}
#subTopic1:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: -20px -20px 21px -4px #94D9F2;
-moz-box-shadow: -20px -20px 21px -4px #94D9F2;
}
#subTopic2:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: 20px -20px 21px -4px #94D9F2;
-moz-box-shadow: 20px -20px 21px -4px #94D9F2;
}
#subTopic3:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: -20px 20px 21px -4px #94D9F2;
-moz-box-shadow: -20px 20px 21px -4px #94D9F2;
}
#subTopic4:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: 20px 20px 21px -4px #94D9F2;
-moz-box-shadow: 20px 20px 21px -4px #94D9F2;
}
<div class="container">
<div class="subTopics" id="subTopic1">
<a href="">
<p>Sub topic 1</p>
</a>
</div>
<div class="subTopics" id="subTopic2">
<a href="">
<p>Sub topic 2</p>
</a>
</div>
<div class="subTopics" id="subTopic3">
<a href="">
<p>Sub topic 3</p>
</a>
</div>
<div class="subTopics" id="subTopic4">
<a href="">
<p>Sub topic 4</p>
</a>
</div>
<div class="circeBack"></div>
<div class="circeFront" id="mainTopic">
<a href="">
<p class="tittel">Main <br> topic</p>
</div>
</div>
Is this what you're looking for? You'll have to view it in full screen mode and then play around with the screen width.
I added the dashed borders just so that you can see what's going on. This is something I often do during development, I find it helps me visualise the layout.
Thanks!
body {
background-color: #BEE5F4;
overflow-x: hidden;
}
.container {
position: relative;
display: flex;
flex-direction: column;
height: 100vh;
width: 100%;
}
.row {
position: relative;
display: flex;
flex-grow: 1;
border: 1px dashed red;
padding: 5px;
margin: 5px;
align-content: center;
justify-content: center;
}
.subTopics {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
background: #94D9F2;
color: #000000;
font-weight: 700;
font-size: large;
margin: 30px;
}
.circle-container {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 300px;
height: 300px;
}
.circeBack {
position: relative;
width: 100%;
height: 100%;
border-radius: 50% 50% 50% 50%;
background-color: #BEE5F4;
}
#mainTopic {
width: 250px;
height: 250px;
border-radius: 50% 50% 50% 50%;
border: solid 1px rgb(255, 255, 255);
background-color: #ffffff;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: #000000;
font-weight: 700;
overflow: hidden;
}
.tittel {
color: rgb(0, 0, 0);
position: relative;
top: 40px;
font-size: xx-large;
text-align: center;
color: #000000;
font-weight: 700;
}
#media only screen and (max-width: 700px) {
.row {
flex-direction: column;
}
.row-desktop {
display: none;
}
.row-mobile {
display: flex;
align-items: center;
}
.subTopics {
margin: 30px 0px 30px 0px;
min-height: 100px;
}
}
#media only screen and (min-width: 701px) {
.row-desktop {
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99;
}
}
a {
text-decoration: none;
color: #000000;
}
#mainTopic:hover {
background-color: rgb(255, 255, 255);
box-shadow: 2px 2px 22px 2px #94D9F2;
-webkit-box-shadow: 1px 1px 21px 1px #94D9F2;
-moz-box-shadow: 1px 1px 21px 1px #94D9F2;
}
#subTopic1:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: -20px -20px 21px -4px #94D9F2;
-moz-box-shadow: -20px -20px 21px -4px #94D9F2;
}
#subTopic2:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: 20px -20px 21px -4px #94D9F2;
-moz-box-shadow: 20px -20px 21px -4px #94D9F2;
}
#subTopic3:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: -20px 20px 21px -4px #94D9F2;
-moz-box-shadow: -20px 20px 21px -4px #94D9F2;
}
#subTopic4:hover {
background-color: rgb(255, 255, 255);
box-shadow: 10px 6px 21px -4px #94D9F2;
-webkit-box-shadow: 20px 20px 21px -4px #94D9F2;
-moz-box-shadow: 20px 20px 21px -4px #94D9F2;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="row row-mobile row-desktop">
<div class="circle-container">
<div class="circeBack"></div>
<div class="circeFront" id="mainTopic"><a href="">
<p class="tittel">Main <br> topic</p>
</div>
</div>
</div>
<div class="row">
<div class="subTopics" id="subTopic1"><a href="">
<p>Sub topic 1</p>
</a>
</div>
<div class="subTopics" id="subTopic2"><a href="">
<p>Sub topic 2</p>
</a>
</div>
</div>
<div class="row">
<div class="subTopics" id="subTopic3"><a href="">
<p>Sub topic 3</p>
</a>
</div>
<div class="subTopics" id="subTopic4"><a href="">
<p>Sub topic 4</p>
</a>
</div>
</div>
</div>
</body>
</html>
i want the boxshadow to fit the entire width of the parent div that is wrapper.
i have a div with class emptydiv and i have added box shadow only to top. doing so it will create a box shadow that is cut at the edges like in picture below.
.wrapper {
position: absolute;
bottom: 32px;
width: 316px;
height: 225px;
background: white;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.29);
border-radius: 16px;
display: flex;
flex-direction: column;
opacity: 1;
}
.container_one {
height: 101px;
width: 316px;
padding: 16px 6px 16px 22px;
border-radius: 16px 16px 0 0;
box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.29);
margin: 0px -6px 0px -6px;
}
.description {
height: 42px;
width: 289px;
margin-top: 8px;
color: black;
display: flex;
font-size: 12px;
font-weight: 400;
margin-bottom: 16px;
`;
.container_two {
padding: 16px 0px 16px 10px;
max-height: 108px;
display: flex;
flex-wrap: wrap;
overflow-x: hidden;
& > div {
margin-right: 4px;
margin-bottom: 16px;
}
}
.empty_div{
height: 32px;
width: 316px;
border-radius: 0 0 16px 16px;
box-shadow: 0px -6px 6px -6px rgba(0, 0, 0, 0.29);
margin: 0px -6px 0px -6px;
}
<div class="wrapper">
<div class="container_one">
this has boxshadow that is as expected
<span class="text">sometext</span>
<div class="description">some big description</div>
</div>
<div class="container_two">
this has boxshadow cut at right side
</div>
<div class="empty_div"/>
</div>
Now the problem is how can i set margin on empty_div such that it fits the entire width of wrapper div. right now its cut on the right edge as shown in picture above.
could someone help me with this. thanks.
All you need to do is remove the static width property for the containers with the shadowbox property and it should all work out.
Please review the modified example below. I modified the CSS so it is compatible with the browser as I think you copied and pasted the raw style SASS, LESS or one of those processors.
.wrapper {
position: absolute;
bottom: 32px;
width: 316px;
height: 225px;
background: white;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.29);
border-radius: 16px;
display: flex;
flex-direction: column;
opacity: 1;
}
.container_one {
height: 101px;
padding: 16px 6px 16px 22px;
border-radius: 16px 16px 0 0;
box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.29);
margin: 0px -6px 0px -6px;
}
.description {
height: 42px;
width: 289px;
margin-top: 8px;
color: black;
display: flex;
font-size: 12px;
font-weight: 400;
margin-bottom: 16px;
}
.container_two {
padding: 16px 0px 16px 10px;
max-height: 108px;
display: flex;
flex-wrap: wrap;
overflow-x: hidden;
}
.container_two > div {
margin-right: 4px;
margin-bottom: 16px;
}
.empty_div{
height: 32px;
border-radius: 0 0 16px 16px;
box-shadow: 0px -6px 6px -6px rgba(0, 0, 0, 0.29);
margin: 0px -6px 0px -6px;
}
<div class="wrapper">
<div class="container_one">//this has boxshadow that is as expected
<span class="text">sometext</span>
<div class="description">some big description</div>
</div>
<div class="container_two"> //this has boxshadow cut at right side
</div>
<div class="empty_div"/>
</div>
I'm currently making a forum in school, and I'm working on a profile page. On this profile page, I want to have a couple of banners that the users can choose from. I want to make these banners the same size as the div they're in. I also want them to be centred inside the div and resize it. Is it possible to do what I have shown in the two images where the banner get's cut off when it's resized?
This is my code:
.user-pic {
width: 120px;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
float: left;
margin: 10px;
transition: .4s ease-in-out;
z-index: 2;
}
.user-pic:hover {
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.user-pic-overlay {
width: 120px;
position: absolute;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
margin: 10px;
opacity: 0;
transition: .5s ease-in-out;
z-index: 3;
}
.user-pic-overlay:hover {
opacity: .8;
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
}
.user-header-wrap {
width: 75%;
margin: 25px auto;
box-shadow: 0 5px 35px 0 rgba(0, 0, 0, 0.4);
}
.user-header {
height: 33vh;
margin: auto;
border: 5px solid #1b1b1b;
box-shadow: 0 -25px 100px -22px inset rgba(0, 0, 0, 0.8);
z-index: 2;
}
.user-header-pic {
position: absolute;
z-index: -2;
margin: auto;
width: 75%;
}
.user-header-pic-overlay {
position: absolute;
margin: auto;
height: 33vh;
opacity: 0;
cursor: pointer;
transition: .4s ease-in-out;
}
.user-header-pic-overlay:hover {
opacity: .8;
}
.user-header-nav {
background-color: #1e1e1e;
border: 5px solid #1e1e1e;
text-align: right;
margin: auto;
}
.user-header-btn {
margin: 5px 5px 5px 5px;
padding: .4em .6em;
background-color: #424242;
border-radius: 2px;
font-size: 14px;
color: #f5f5f5;
cursor: pointer;
border: none;
}
.user-haeder-btn:focus {
outline: none;
}
<div class="user-header-wrap">
<div class="user-header">
<img class="user-header-pic" src="../images/header.jpg" alt="">
<img class="user-pic" src="<?php echo $ppp;?>" alt="">
<p class="prof-txt"><?php $ss = $_SESSION["GLOBALNAVN"]; echo $ss; ?></p>
<p class="prof-txt-2">Level</p>
</div>
<div class="user-header-nav">
<button class="user-header-btn">Edit Profile</button>
</div>
</div>
First Image Second Image
added
.user-header-pic {
position: relative;
z-index: -2;
margin: auto;
width: 100%;
height: 100%;
}
.user-pic {
width: 120px;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
float: left;
margin: 10px;
transition: .4s ease-in-out;
z-index: 2;
}
.user-pic:hover {
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.user-pic-overlay {
width: 120px;
position: absolute;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
margin: 10px;
opacity: 0;
transition: .5s ease-in-out;
z-index: 3;
}
.user-pic-overlay:hover {
opacity: .8;
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
}
.user-header-wrap {
width: 75%;
margin: 25px auto;
box-shadow: 0 5px 35px 0 rgba(0, 0, 0, 0.4);
}
.user-header {
height: 33vh;
margin: auto;
border: 5px solid #1b1b1b;
box-shadow: 0 -25px 100px -22px inset rgba(0, 0, 0, 0.8);
z-index: 2;
}
.user-header-pic {
position: relative;
z-index: -2;
margin: auto;
width: 100%;
height: 100%;
}
.user-header-pic-overlay {
position: absolute;
margin: auto;
height: 33vh;
opacity: 0;
cursor: pointer;
transition: .4s ease-in-out;
}
.user-header-pic-overlay:hover {
opacity: .8;
}
.user-header-nav {
background-color: #1e1e1e;
border: 5px solid #1e1e1e;
text-align: right;
margin: auto;
}
.user-header-btn {
margin: 5px 5px 5px 5px;
padding: .4em .6em;
background-color: #424242;
border-radius: 2px;
font-size: 14px;
color: #f5f5f5;
cursor: pointer;
border: none;
}
.user-haeder-btn:focus {
outline: none;
}
<div class="user-header-wrap">
<div class="user-header">
<img class="user-header-pic" src="https://images.unsplash.com/photo-1553052944-763b0cbd086a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" alt="">
<img class="user-pic" src="<?php echo $ppp;?>" alt="">
<p class="prof-txt"><?php $ss = $_SESSION["GLOBALNAVN"]; echo $ss; ?></p>
<p class="prof-txt-2">Level</p>
</div>
<div class="user-header-nav">
<button class="user-header-btn">Edit Profile</button>
</div>
</div>
Basically I have a div that when hovering on it, the text moves to the right. I would like to achieve some effect as if the text were lost inside the div while moving to the right.
.rectangulo_categoria {
border-radius: 34px;
border: 2px solid red;
width: 195px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
-webkit-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 4px 10px -1px rgba(0, 0, 0, 0.75);
}
.rectangulo_categoria:hover .texto_engranen_1 {
transform: translate(168px, 0px);
opacity: 0;
}
.texto_engranen_1 {
line-height: 1;
pointer-events: none;
z-index: 1;
font-size: 12px;
width: auto;
font-weight: 400;
pointer-events: none;
line-height: 1;
transition: 0.5s all ease-out;
opacity: 1;
color: #343434;
}
<div class="rectangulo_categoria" mdbWavesEffect>
<p class="texto_engranen_1 p-0 m-0">Gestion Recursos de Apoyo Académico</p>
</div>
this is my full code:
https://jsfiddle.net/te0p2fqb/
You can add a overflow: hidden; on the div. Also I re-arranged your classes and removed some duplicate props.
.rectangulo_categoria {
border-radius: 34px;
border: 2px solid red;
width: 195px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
-webkit-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 4px 10px -1px rgba(0, 0, 0, 0.75);
overflow: hidden;
}
.texto_engranen_1 {
line-height: 1;
z-index: 1;
font-size: 12px;
width: auto;
font-weight: 400;
pointer-events: none;
transition: 0.5s all ease-out;
opacity: 1;
color: #343434;
}
.rectangulo_categoria:hover .texto_engranen_1 {
transform: translate(168px, -50%);
opacity: 0;
}
<div class="rectangulo_categoria" mdbWavesEffect>
<p class="texto_engranen_1 p-0 m-0">Gestion Recursos de Apoyo Académico</p>
</div>
EDIT
Sure check the code on fiddle for aboslute solution. The main changes are that I removed the flex and its attributes, also reset the margin and padding on the <p>.
add overflow: hidden; to your .rectangulo_categoria class
.rectangulo_categoria{
border-radius: 34px;
border: 2px solid red;
width: 195px;
height: 50px;
display: flex;
justify-content: center;
align-items:center;
-webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
box-shadow: 8px 4px 10px -1px rgba(0, 0, 0, 0.75);
overflow: hidden; // this is your solution
}
How can I cut the full corner off a div, keeping it transparent.
This is what I've tried:
.well-corner {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background: rgba(8, 12, 23, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
border-top-right-radius: 50px;
}
.well-link {
float: right;
}
.diagonal {
float: left;
width: 50px;
transform: skewX(-10deg);
}
<div class="well-corner clearfix">
<div class="diagonal">
</div>
<a class="well-link" href="">Test</a>
</div>
Outcome:
Wanted outcome (Image edited):
I have created a JSFiddle here:http://jsfiddle.net/x7fnxu2w/
demo - http://jsfiddle.net/x7fnxu2w/3/
use :pseudo element :before for styling the triangle used yellow border to hide the other part of the div
and used border style dotted to fix the pix-elated issue
body {
background-color: yellow;
}
.well-corner {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background: rgba(8, 12, 23, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
border-top-right-radius: 50px;
position: relative;
width: 430px;
}
.well-corner:before {
content: '';
display: inline-block;
width: 0;
height: 0;
position: absolute;
top: 0;
left: 0;
border-style: dotted;
border-color: yellow rgba(56, 59, 18, 1) transparent transparent;
border-width: 58px 53px 0px 0px;
}
.well-link {
float: right;
}
.diagonal {
float: left;
width: 50px;
transform: skewX(-10deg);
}
<!-- What I've tried -->
<div class="well-corner clearfix">
<div class="diagonal"></div> <a class="well-link" href="">Test</a>
</div>
<!-- Edited image, wanted outcome -->
<img src="http://i.gyazo.com/7cb269f66e7b0bd3870c8b04ac52f4cd.png">
svg solution without any CSS:
The entire shape could be achieved without any CSS if you use svg.
<body style="background-color: yellow">
<svg height="60" width="470">
<path d="M0,60 L50,0 L420,0 A56,56 0 0,1 470,60z" fill="#374418" />
<a xlink:href="#">
<text x="410" y="37" font-size="18" font-weight="500" fill="yellow">Test</text>
</a>
</svg>
</body>
CSS Solution:
You can add a triangle to the :before element.
body {
background-color: yellow;
}
.well-corner {
width: 430px;
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background: rgba(8, 12, 23, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
border-top-right-radius: 50px;
}
.well-link {
float: right;
}
.well-corner:before {
content: '';
position: relative;
top: -39px;
left: -20px;
width: 0;
height: 0;
border-top: 0px solid transparent;
border-bottom: 65px solid transparent;
border-left: 55px solid yellow;
}
<div class="well-corner clearfix">
<a class="well-link" href="">Test</a>
</div>
<img src="http://i.gyazo.com/7cb269f66e7b0bd3870c8b04ac52f4cd.png" />
You can create a div and specify the border width and place it in the appropriate position
.triangle1 {
border-bottom: 58px solid #383B12;
border-left: 58px solid yellow;
font-size: 0px;
float: left;
line-height: 0%;
width: 0px;
}
.triangle2 {
border-bottom: 58px solid red;
border-left: 58px solid blue;
font-size: 0px;
float: left;
line-height: 0%;
width: 0px;
}
body {
background-color: yellow;
}
.well-corner {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background: rgba(8, 12, 23, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
border-top-right-radius: 50px;
}
.well-link {
float: right;
}
.diagonal {
float: left;
width: 50px;
transform: skewX(-10deg);
}
<h1>This is what you want</h1>
<div class="triangle1">
</div>
<div class="well-corner clearfix">
<div class="diagonal">
</div>
<a class="well-link" href="">Test</a>
</div>
<h1>Here is how it works</h1>
<div class="triangle2">
</div>
<div class="well-corner clearfix">
<div class="diagonal">
</div>
<a class="well-link" href="">Test</a>
</div>
I have created a JSBin with your existing code and added two divs with classes triangle1 and triangle2 to demonstrate what you require and how it works
http://jsbin.com/vesoko/4/edit?html,css,output