I'm using Owlcarousel 2 (ngx-owl-carousel-o) and work good till i have 4/5 box image, but if i receive only one item or two the box with the image come too big, how i can fix this problem?
attach the image where up you can see the box image as single item, too big,
and below you can see with 5 items the size it's ok.
example http://betoffice.it
click in the button ALL under search
My Scss file
.content-carousel
{
max-width: 85vw !important;
margin: 0 auto;
padding: 0 0 1.5rem;
&.category-na {
.owl-carousel .owl-item {
width: 100% !important;
}
}
.category-title {
display: flex;
justify-content: space-between;
align-items: center;
h2 {
padding-left: 10px;
text-transform: uppercase;
font-size: 16px;
}
a{
margin-right: 10px;
}
}
.single-item {
height: 100%;
display: flex;
flex-direction: column;
border: 1px solid #e4e4e4;
border-radius: 3px;
.box-img {
position: relative;
&::after {
content:'';
position: absolute;
#include bg-icon('play', center, contain, 'png');
width: 47px;
height: 47px;
transition: opacity .8s ease-in-out;
opacity: 0;
z-index: 10;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
&::before {
content:'';
position: absolute;
background-color: rgba(1,20,48,.5);
z-index: 9;
opacity: 0;
transition: opacity .7s ease-in-out;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
&:hover {
&::before {
opacity: 1;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
&::after {
opacity: 1;
}
.date-start {
opacity: 0;
}
}
img {
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
}
.box-meeting-info {
display: flex;
flex-direction: column;
flex-grow: 1;
p{
color: #1a1a1a;
&:hover, &:focus {
color: #1a1a1a;
}
}
}
}
.owl-carousel {
.owl-item {
padding: 0 10px;
}
}
}
#include media-breakpoint-up(xxl){
.content-carousel {
padding: 0 3rem 1.5rem;
}
}
owl-carousel-o {
.single-item {
background-color: #fff;
border: 1px solid #ccc;
.box-meeting-info {
position: relative;
padding: 1em;
}
&:hover {
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
}
.owl-carousel {
.content-link-video {
text-decoration: none;
}
.owl-stage {
display: flex;
padding-bottom: 15px;
}
}
.owl-theme .owl-nav {
position: absolute;
top: 30%;
width: 100%;
display: none;
.owl-prev, .owl-next {
border: 1px solid #ccc;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
border-radius: 1px;
&:hover {
background-color: #e0dede;
}
&::before {
content:'';
height: 12px;
width: 26px;
opacity: 0.5;
}
}
.owl-prev {
left: -50px;
position: absolute;
&::before {
#include bg-icon('arrow-left', center, contain, 'png');
}
}
.owl-next {
right: -50px;
position: absolute;
&::before{
#include bg-icon('arrow-right', center, contain, 'png');
}
}
}
#include media-breakpoint-up(xl) {
.owl-theme .owl-nav {
display: block;
}
}
}
Component.html
component.html
<div class="carousel-container">
<div class="content-carousel">
<div class="category-title">
<h2>Meetings</h2>
<!--<a *ngIf="item.children.length >= 10" (click)="seeAllData(item.title)" class="btn b-button" [textContent]="'View More'"></a>-->
</div>
<owl-carousel-o [options]="customOptions">
<ng-container *ngFor="let item of uniqueMeetings; let i = index">
<ng-template carouselSlide [id]="i">
<a class="content-link-video" (click)="navigateTo(item._source.session_WIPOs2tId)">
<div class="single-item">
<div class="box-img">
<img [lazyLoad]="item._source.session_thumbnail" [defaultImage]="defaultImage" alt=""/>
<div class="date-start">
<p>{{item._source.session_startDate | date:'dd MMM yyyy'}}<span class="separator-time"> - </span><span class="time-video">{{item._source.session_startDate | date:'H:mm:ss'}}</span></p>
</div>
</div>
<div class="box-meeting-info">
<div class="box-article">
<p class="name-product">{{item._source.session_name}}</p>
</div>
</div>
</div></a>
</ng-template>
</ng-container>
</owl-carousel-o>
</div>
</div>
Related
When I hover over the square, I want the text "MENU" to go and "Google" and "Youtube" to appear. I gave the opacity value for it. "MENU" text disappears but other texts are not visible. Why is Youtube and Google text not showing?
I gave visibility: visible and visibility: hidden instead of opacity but I still get the same result. Am i selecting the wrong div's?
CSS body {
background-color: aquamarine;
}
.square {
width: 100px;
height: 100px;
border-radius: 10px;
background-color: azure;
position: relative;
transition: 1s transform;
}
.square:hover {
transform: scale(4);
}
.div1::after {
position: absolute;
content: "MENU";
right: 27px;
top: 40px;
}
.square:hover div:nth-child(1) {
opacity: 0;
}
.div2::after {
content: "- Google";
position: absolute;
bottom: 25px;
right: 5px;
font-size: 10px;
border: 2px solid grey;
padding: 2px;
opacity: 0;
}
.square:hover div:nth-child(2) {
opacity: 1;
}
.div3::after {
content: "- Youtube";
position: absolute;
bottom: 2px;
right: 5px;
font-size: 10px;
border: 2px solid grey;
padding: 2px;
opacity: 0;
}
.square:hover div:nth-child(3) {
opacity: 1;
}
HTML
<div class="square">
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</div>
If you have added content using after , then add after in those hover also to work the way you want.
That is use .square:hover div:nth-child(2):after instead of .square:hover div:nth-child(2) only
It works like this see below snippet :
body {
background-color: aquamarine;
}
.square {
width: 100px;
height: 100px;
border-radius: 10px;
background-color: azure;
position: relative;
transition: 1s transform;
}
.square:hover {
transform: scale(4);
}
.div1::after {
position: absolute;
content: "MENU";
right: 27px;
top: 40px;
}
.square:hover div:nth-child(1) {
opacity: 0;
}
.div2::after {
content: "- Google";
position: absolute;
bottom: 25px;
right: 5px;
font-size: 10px;
border: 2px solid grey;
padding: 2px;
opacity: 0;
}
.square:hover div:nth-child(2):after {
opacity: 1;
}
.div3::after {
content: "- Youtube";
position: absolute;
bottom: 2px;
right: 5px;
font-size: 10px;
border: 2px solid grey;
padding: 2px;
opacity: 0;
}
.square:hover div:nth-child(3):after {
opacity: 1;
}
<div class="square">
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</div>
I changed your code a bit. See if this does what you need:
I added transform-origin: top left; to prevent the scaling from happening in all directions which caused some of the element to be displayed outside of the viewport.
I got rid of the :after pseudo-elements as they did not contribute to the desired outcome and only complicated things (in my opinion).
CSS body {
background-color: aquamarine;
}
.options {
height: 100px;
margin-top: 5px;
display: none;
}
.options>div {
border: 2px solid gray;
margin-bottom: 4px;
}
.square {
width: 100px;
height: 100px;
border: 1px solid gray;
border-radius: 10px;
background-color: azure;
position: relative;
transition: 1s transform;
}
.square:hover {
transform-origin: top left;
transform: scale(4);
}
.menu {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.square:hover .options {
display: block;
font-size: 10px;
padding: 2px;
}
.square:hover .menu {
display: none;
}
<div class="square">
<div class="menu">Menu</div>
<div class="options">
<div class="div2">Google</div>
<div class="div3">You Tube</div>
</div>
</div>
I have a button and if you hover on it a "popup" appears on the right. My problem is that I want to keep the space between the button and the popup. Sometimes it works but sometimes the div is not getting the correct property opacity:1; Does anyone have some tips on how to continue? http://jsfiddle.net/de8afuvr/
<div class="timer-container">
test
</div>
<div class="auto-update-container">
<span class="active" title="Refresh every 10 seconds">10s</span>
<span title="Refresh every 30 seconds">30s</span>
<span title="Refresh every minute">1m</span>
<span title="Refresh every 5 minutes">5m</span>
<span title="Refresh every 15 minutes">15m</span>
</div>
.map-toggles {
background-color: #fff;
border-radius: 2px;
bottom: 36px;
display: flex;
flex-direction: column-reverse;
left: 17px;
max-height: 42px;
overflow: hidden;
position: absolute;
transition: all 200ms linear;
z-index: 1;
&.open,
&:hover {
max-height: 600px;
overflow: visible;
box-shadow: 2px 5px 16px rgba(51, 51, 51, 0.2) !important;
border-radius: 7px;
}
.toggle {
align-items: center;
color: #465b67;
cursor: pointer;
display: flex;
flex: 0 0 auto;
font-size: 24px;
height: 42px;
justify-content: center;
position: relative;
width: 42px;
&.off {
background-color: #495054;
color: #869096;
background-color: transparent;
color: #c3d4de;
}
&.disabled {
box-shadow: none !important;
&::after {
content: '';
width: 3px;
height: 30px;
transform: rotate(45deg);
background-color: rgb(212, 87, 87);
position: absolute;
}
}
}
.toggle-autoupdate {
.auto-update-container {
align-items: center;
background-color: #fff;
display: flex;
flex-wrap: wrap;
height: auto;
justify-content: center;
left: 42px;
opacity: 0;
position: absolute;
pointer-events: none;
top: 0;
transition: all 200ms linear;
width: 70px;
background: #fff;
margin-left: 10px;
box-shadow: 2px 5px 16px rgba(51, 51, 51, 0.2);
border-radius: 7px;
>span {
align-items: center;
display: flex;
font-size: 1rem;
height: 42px;
justify-content: center;
width: 100%;
&:hover {
background-color: #456994;
color: #fff;
box-shadow: none !important;
}
&.active {
color: #fff;
background-color: #456994;
}
}
}
&:hover {
>.auto-update-container {
opacity: 1;
pointer-events: all;
}
}
&.disabled {
&:hover {
>.auto-update-container {
opacity: 0;
pointer-events: none;
}
}
}
}
}
.autoupdatediv {
margin-top: 100px;
bottom: auto;
top: 36px;
left: 20px;
padding: 1px;
}
Just add padding to this class this will work hopefully.
.timer-container: padding: 10px 15px;
I just fooled around with HTML/CSS to build me a page with a youtube-video with a button on top of it.
* { box-sizing: border-box; }
.video-background {
background: #000;
position: fixed;
top: 0; right: 0; bottom: 0; left: 0;
z-index: -99;
}
.video-background iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
html, body {
height: 100%;
margin: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
}
.btn-wrapper {
width: 290px;
height: 110px;
position: relative;
margin: 40px auto 0;
}
.btn-wrapper:hover .btn-inner {
top: -4px;
transform: scale(1, 1);
cursor: pointer;
}
.btn-wrapper__container {
border-bottom: 2px solid #15b5e2;
position: absolute;
width: 100%;
height: 80px;
}
.btn-wrapper__container:before, .btn-wrapper__container:after {
border-bottom: 2px solid #15b5e2;
width: 96%;
left: 2%;
bottom: -8px;
content: "";
position: absolute;
}
.btn-wrapper__container:after {
width: 92%;
left: 4%;
bottom: -14px;
}
.btn-wrapper__container .btn-inner {
width: 104.2%;
height: 100%;
position: absolute;
top: 20px;
left: -2.1%;
border: 2px solid #15b5e2;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Source Code Pro', monospace;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 18px;
background: #10131c;
transform: scale(0.96, 0.96);
transition: all 0.3s;
z-index: 4;
}
.btn-wrapper__container .btn-inner__text {
text-decoration: none;
color: #15b5e2;
}
<div class="video-background">
<iframe src="https://www.youtube.com/embed/TMzouTzim0o?controls=1&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ" frameborder="0" allowfullscreen></iframe>
</div>
<div class="btn-wrapper">
<div class="btn-wrapper__container">
<div class="btn-inner">
<a class="btn-inner__text" href="#">Hover Me</a>
</div>
</div>
</div>
While without the button added, the video is shown in background, responsive and fullscreen, with control-elements enabled. If i add the hover-button, I am no longer able to control the video in background (360 video).
How can I enable the controls of the video and still have the button usable?
I am unfortunately not a coding expert, I've puzzled these pieces together of code I found in tutorials.
Remove css property z-index: -99 from class .video-background {...}, that will fix the issue.
* {
box-sizing: border-box;
}
.video-background {
background: #000;
position: fixed;
top: 0; right: 0; bottom: 0; left: 0;
/* z-index: -99; */ /* Remove this line */
}
.video-background iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
html,
body {
height: 100%;
margin: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
}
.btn-wrapper {
width: 290px;
height: 110px;
position: relative;
margin: 40px auto 0;
}
.btn-wrapper:hover .btn-inner {
top: -4px;
transform: scale(1, 1);
cursor: pointer;
}
.btn-wrapper__container {
border-bottom: 2px solid #15b5e2;
position: absolute;
width: 100%;
height: 80px;
}
.btn-wrapper__container:before,
.btn-wrapper__container:after {
border-bottom: 2px solid #15b5e2;
width: 96%;
left: 2%;
bottom: -8px;
content: "";
position: absolute;
}
.btn-wrapper__container:after {
width: 92%;
left: 4%;
bottom: -14px;
}
.btn-wrapper__container .btn-inner {
width: 104.2%;
height: 100%;
position: absolute;
top: 20px;
left: -2.1%;
border: 2px solid #15b5e2;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Source Code Pro', monospace;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 18px;
background: #10131c;
transform: scale(0.96, 0.96);
transition: all 0.3s;
z-index: 4;
}
.btn-wrapper__container .btn-inner__text {
text-decoration: none;
color: #15b5e2;
}
<div class="video-background">
<iframe src="https://www.youtube.com/embed/TMzouTzim0o?controls=1&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ"
frameborder="0" allowfullscreen></iframe>
</div>
<div class="btn-wrapper">
<div class="btn-wrapper__container">
<div class="btn-inner">
<a class="btn-inner__text" href="#">Hover Me</a>
</div>
</div>
</div>
I am almost finish with building the skeleton of my simon game clone and the only left I want to do is set the container (which holds the game itself) to have a max height of 605px.
I was able to accomplish its width max when it reaches a certain threshold in the viewport but I am having hard time applying the same behavior but horizontally instead.
Any inputs will be greatly appreciated.
I've attached my code in CodePen as well:
http://codepen.io/neotriz/pen/RRxOJb
body {
background: skyblue;
font-family: 'Righteous', cursive;
box-sizing: border-box; }
.container {
width: 100%;
display: flex;
flex-wrap: wrap; }
.game {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 70vh;
margin-top: 10px; }
.button {
position: relative;
display: block;
height: 50%;
width: 50%;
margin-bottom: 1px; }
#green {
background: #39d565;
border-top-left-radius: 25%;
box-shadow: 0 6px 0 #0d934b;
bottom: 6px;
transition: all 0.1s linear; }
#green:active {
bottom: 0px;
box-shadow: 0px 0px 0px #0d934b; }
#red {
background: #d23a51;
border-top-right-radius: 25%;
box-shadow: 0 6px 0 #711515;
bottom: 6px;
transition: all 0.1s linear; }
#red:active {
bottom: 0px;
box-shadow: 0px 0px 0px #711515; }
#blue {
background: #09f;
border-bottom-left-radius: 25%;
box-shadow: 0 6px 0 #06c;
bottom: 6px;
transition: all 0.1s linear; }
#blue:active {
bottom: 0px;
box-shadow: 0px 0px 0px #06c; }
#yellow {
background: #FD9A01;
border-bottom-right-radius: 25%;
box-shadow: 0 6px 0 #916828;
bottom: 6px;
transition: all 0.1s linear; }
#yellow:active {
bottom: 0px;
box-shadow: 0px 0px 0px #916828; }
.score {
width: 100%;
height: 10vh;
text-align: center;
color: #FFF;
text-shadow: 1px 3px 2px black;
margin-bottom: 5px; }
.control-panel {
text-align: center;
width: 100%;
display: flex;
flex-wrap: wrap;
position: relative;
height: 15vh;
align-items: center;
justify-content: center;
background: #aaaaaa;
border-radius: 10px; }
.control-panel #on-off-btn {
width: 33.3333%; }
.control-panel #level {
width: 33.3333%; }
.control-panel #start {
width: 33.3333%; }
.control-panel p {
margin: 8px 0px 0px 0px; }
.cmn-toggle {
position: absolute;
margin-left: -9999px;
visibility: hidden; }
.cmn-toggle + label {
display: block;
position: relative;
cursor: pointer;
outline: none;
user-select: none; }
input.cmn-toggle-round + label {
padding: 2px;
max-width: 90%;
height: 35px;
background-color: #dddddd;
border-radius: 60px;
margin-top: 9px;
margin-left: 5px; }
input.cmn-toggle-round + label:before,
input.cmn-toggle-round + label:after {
display: block;
position: absolute;
top: 1px;
left: 1px;
bottom: 1px;
content: ""; }
input.cmn-toggle-round + label:before {
right: 1px;
background-color: white;
border-radius: 60px;
transition: background 0.4s; }
input.cmn-toggle-round + label:after {
width: 38px;
background-color: #fff;
border-radius: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
transition: margin-left 0.4s; }
input.cmn-toggle-round:checked + label:before {
background-color: #8ce196; }
input.cmn-toggle-round:checked + label:after {
margin-left: 58%; }
.btn-round {
width: 50%;
height: 50px;
background: #ed2914;
border-radius: 100%;
outline: none;
box-shadow: 0 6px 0 #711515;
bottom: 6px;
transition: all 0.1s linear; }
.btn-round:active {
bottom: 0px;
box-shadow: 0px 0px 0px #711515; }
#media screen and (max-width: 311px) {
input.cmn-toggle-round:checked + label:after {
margin-left: 45%; } }
#media screen and (min-width: 426px) {
.container {
width: 426px;
margin-left: auto;
margin-right: auto; }
input.cmn-toggle-round:checked + label:after {
margin-left: 66%; } }
#media screen and (min-height: 605px) {
.container {
height: 605px; } }
<!DOCTYPE html>
<html lang="en">
<head>
<title>Simon Game FCC</title>
</head>
<body>
<div class="container">
<div class="game">
<div id="green" class="button"></div>
<div id="red" class="button"></div>
<div id="blue" class="button"></div>
<div id="yellow" class="button"></div>
</div>
<div class="score">
<h2>Score: 0 </h2>
</div>
<div class="control-panel">
<div id="on-off-btn">
<input id="on-off-slider"type="checkbox" class="cmn-toggle cmn-toggle-round">
<label for="on-off-slider"></label>
<p>Off/On</p>
</div>
<div id="level">
<input id="level-slider"type="checkbox" class="cmn-toggle cmn-toggle-round">
<label for="level-slider"></label>
<p>Level</p>
</div>
<div id="start">
<button class="btn-round"></button>
<p>(re)Start</p>
</div>
</div>
</div>
</body>
</html>
I think mixing vh heights and flex disposition is part of the problem because it makes the code a bit tricky to adjust. So I would suggest to remove all vh heights that are inside the container and replace them with a flex vertical positionning.
Here is the sccs I get (only the changed rules are here) :
.container {
width: 100%;
display: flex;
flex-wrap: wrap;
height: 100vh;
flex-direction: column;
justify-content: center; }
.game {
display: flex;
flex-wrap: wrap;
width: 100%;
margin-top: 10px;
flex: 1 1 auto; }
.score {
width: 100%;
text-align: center;
color: #FFF;
text-shadow: 1px 3px 2px black;
margin-bottom: 5px;
flex: 0 0 auto; }
.control-panel {
text-align: center;
width: 100%;
display: flex;
flex-wrap: wrap;
position: relative;
align-items: center;
justify-content: center;
background: #aaaaaa;
border-radius: 10px;
flex: 0 0 auto; }
So i am trying to change the element of a different div using the :hover effect in CSS.
If you check my code you should understand what I am trying to accomplish.
When you hover over the project button i would like the slider-container to have the text 'projects' and so on for all of the buttons
I understand that the button needs to be before the slider container which it is, so i really don't understand why this is not working?
If anybody could either direct me to a better tutorial on using this hover effect and help me understand what the issue is i would be really appreciative.
Thanks Guys! :)
#content {
position: relative;
overflow: hidden;
width: 900px;
height: 440px;
background: #D5D5D5;
margin: auto;
top: 50px; left: 0; bottom: 0; right: 0;
-webkit-box-shadow: 0px 0px 23px 3px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 0px 23px 3px rgba(0,0,0,0.75);
box-shadow: 0px 0px 23px 3px rgba(0,0,0,0.75);
}
.logo-container{
display: flex;
flex-direction: row;
position: relative;
width: 100%;
height: 100px;
justify-content: center;
margin: auto;
float: right;
top: 0px;
}
.blockicon {
position: relative;
width: 50px;
height: 50px;
top: 15px;
border-radius: 50%;
border: solid 5px black;
cursor: pointer;
font-size: 30px;
text-align: center;
vertical-align: middle;
line-height: 50px;
margin: 0 0.8%;
}
.projects {
background: #801113;
}
.projects:hover > .slider-container {
background: #801113;
}
.projects:hover > .slider-container:before {
content:"Projects";
}
.aboutme {
background: #1A8305;
}
.aboutme:hover > .slider-container {
background: #1A8305;
}
.aboutme:hover > .slider-container:before {
content:"About Me";
}
.contactme {
background: #E8BA1A;
}
.contactme:hover > .slider-container {
background: #E8BA1A;
}
.contactme:hover > .slider-container:before {
content:"Contact Me";
}
.helped {
background: #0049BB;
}
.helped:hover > .slider-container {
background: #0049BB;
}
.helped:hover > .slider-container:before {
content:"Helped";
}
.hobbys {
background: #A40CA3;
}
.hobbys:hover > .slider-container {
background: #A40CA3;
}
.hobbys:hover > .slider-container:before {
content:"Hobbys";
}
.slider-container {
position:absolute;
background: #CF4000;
width: 95%;
height: 320px;
margin: auto;
top: 400px; left: 0; bottom: 0; right: 0;
}
.slider-container:before {
position:absolute;
content:"Test";
font-size: 30px;
bottom: 20%;
left: 40%;
font-family: Aldrich;
padding: 0;
font-weight: bold;
color: white;
z-index: 999;
}
#media screen and (max-width: 900px) {
#content {
width: 100%;
}
#content-container {
width: 100%;
}
#footer {
width: 100%;
}
}
<div id="content">
<div class="logo-container">
<div class="blockicon projects"> P </div>
<div class="blockicon aboutme"> A </div>
<div class="blockicon contactme"> C </div>
<div class="blockicon helped"> H </div>
<div class="blockicon hobbys"> H </div>
<div class="slider-container">
</div>
</div>
</div>
Just use the general sibling combinator ~ and it will work.
#content {
position: relative;
overflow: hidden;
width: 900px;
height: 440px;
background: #D5D5D5;
margin: auto;
top: 210px;
left: 0;
bottom: 0;
right: 0;
-webkit-box-shadow: 0px 0px 23px 3px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 23px 3px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 23px 3px rgba(0, 0, 0, 0.75);
}
.logo-container {
display: flex;
flex-direction: row;
position: relative;
width: 100%;
height: 100px;
justify-content: center;
margin: auto;
float: right;
top: 0px;
}
.blockicon {
position: relative;
width: 50px;
height: 50px;
top: 15px;
border-radius: 50%;
border: solid 5px black;
cursor: pointer;
font-size: 30px;
text-align: center;
vertical-align: middle;
line-height: 50px;
margin: 0 0.8%;
}
.projects {
background: #801113;
}
.projects:hover ~ .slider-container {
background: #801113;
}
.projects:hover ~ .slider-container:before {
content: "Projects";
}
.aboutme {
background: #1A8305;
}
.aboutme:hover ~ .slider-container {
background: #1A8305;
}
.aboutme:hover ~ .slider-container:before {
content: "About Me";
}
.contactme {
background: #E8BA1A;
}
.contactme:hover ~ .slider-container {
background: #E8BA1A;
}
.contactme:hover ~ .slider-container:before {
content: "Contact Me";
}
.helped {
background: #0049BB;
}
.helped:hover ~ .slider-container {
background: #0049BB;
}
.helped:hover ~ .slider-container:before {
content: "Helped";
}
.hobbys {
background: #A40CA3;
}
.hobbys:hover ~ .slider-container {
background: #A40CA3;
}
.hobbys:hover ~ .slider-container:before {
content: "Hobbys";
}
.slider-container {
position: absolute;
background: #CF4000;
width: 95%;
height: 320px;
margin: auto;
top: 400px;
left: 0;
bottom: 0;
right: 0;
}
.slider-container:before {
position: absolute;
content: "Test";
font-size: 30px;
bottom: 20%;
left: 40%;
font-family: Aldrich;
padding: 0;
font-weight: bold;
color: white;
z-index: 999;
}
#media screen and (max-width: 900px) {
#content {
width: 100%;
}
#content-container {
width: 100%;
}
#footer {
width: 100%;
}
}
<div id="content">
<div class="logo-container">
<div class="blockicon projects">P</div>
<div class="blockicon aboutme">A</div>
<div class="blockicon contactme">C</div>
<div class="blockicon helped">H</div>
<div class="blockicon hobbys">H</div>
<div class="slider-container">
</div>
</div>
</div>
see here : jsfiddle
( changed only for .projects )
> means directly the element inside it's parent. for eg : parent > child.
for elements that are siblings like .projects and .slider-container use ~
for eg :
.projects:hover ~ .slider-container {
background: #801113;
}
.projects:hover ~ .slider-container:before {
content:"Projects";
}