I have a webpage where I have the parent div with relative positioning, and all text with absolute positioning. I have now noticed that I cannot move around the image at all. What should I do?
http://jsfiddle.net/uchn0m5k/1/
I want the image to be behind (in terms of Z Space) the text, but as I want to add more images, I do not wish to set it as the background image:)
.button {
background-color: #08aabe;
border: none;
color: #faead3;
padding: 0.2em 0.65em;
text-decoration: none;
font-size: 2.3vw;
margin-left: 5em;
letter-spacing: 0.02em;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
img {
max-width: 100%;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.container {
position: relative;
height: 100vh;
}
/* Top left text */
.top-left {
position: absolute;
top: 8px;
left: 16px;
}
.top-left h1 {
margin: 0px;
font-size: 4.5vw;
color: #08aabe;
margin-left: 2.5em;
padding-top: 3em;
padding-bottom: 0.2em;
}
body {
margin: 0px;
font-family: sans-serif;
background-color: black;
}
#squiggle {
right: 30vw;
}
<div class="container">
<img id="squiggle" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png" style=" height:30%;">
<div class="top-left">
<h1>Lorem Ipsum.</h1>
<a class="button" href="#">Button to clcik</a>
</div>
</div>
Did you try to do like this?
.button {
background-color: #08aabe;
border: none;
color: #faead3;
padding: 0.2em 0.65em;
text-decoration: none;
font-size: 2.3vw;
margin-left: 2em;
letter-spacing: 0.02em;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
img{
max-width: 100%;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.container {
position: relative;
height:100vh;
}
/* Top left text */
.top-left {
position: absolute;
top: 8px;
left: 16px;
}
.top-left h1{
margin:0px;
font-size: 4.5vw;
color: #08aabe;
margin-left: 1em;
padding-top: 1em;
padding-bottom: 0.2em;
}
body{
margin: 0px;
font-family: sans-serif;
background-color:black;
}
#squiggle{
position:absolute;
left: 22vw;
top: 29px;
}
.container{
position:relative;
}
<div class="container">
<img id="squiggle" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png" style=" height:30%;">
<div class="top-left">
<h1>Lorem Ipsum.</h1>
<a class="button"href="#">Button to clcik</a>
</div>
</div>
So, I think this is what you're asking for? I switched up the CSS and basically added z-indexes to the "container", "img" and "top-left" elements, which moved the image of the dice behind the "top-left" container.
img{
max-width: 100%;
position: absolute;
z-index: -2;
top: 120px;
left: 40px;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.container {
position: relative;
height:100vh;
z-index: -3;
}
/* Top left text */
.top-left {
position: absolute;
top: 8px;
left: 16px;
z-index: -1;
}
Hope this answers your question. If not, please let me know and I'd be happy to try to figure out a better solution!
Updated Answer:
You can view this codepen.
body {
background: black;
font-family: sans-serif;
}
.logo {
position: absolute;
top: 5em;
left: 5em;
z-index: -1;
}
.logo-text {
position: absolute;
top: 4em;
left: 4em;
z-index: 1;
}
h1.logo-text {
color: #fff;
}
<div class="container">
<div class="logo">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png">
</div>
<h1 class="logo-text">Lorem Ipsum</h1>
</div>
Related
screenshot
I have a video intro at the top of my website, and I want the website content to be underneath it. But when I added a test line of text, it appears ontop of it. The only thing keeping it from being right at the top is the header. Any help appriciated.
CSS:
:root {
--bg-color: #141414;
--text-color: #fff;
--default-text-color: #fff;
--secondary-color: #ff0000;
}
body {
background-color: var(--bg-color);
color: var(--default-text-color);
font-family: Rubik;
font-weight: 400;
width: 100%;
position: static!important;
top: 0!important;
margin: 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.loader {
position: fixed;
height: 100vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-color);
transition: all .5s;
z-index: 99;
cursor: progress;
overflow: hidden;
}
.loader .logo {
font-size: 70px;
color: var(--text-color);
font-family: 'adrippingmarker', Arial;
}
.privacy-policy {
position: absolute;
display: block;
bottom: 0;
margin-bottom: 20px;
font-family: Arial;
font-weight: 900;
text-decoration: none;
color: var(--text-color);
}
.privacy-policy:hover {
cursor: default;
}
.navbar {
width: 100%;
margin: 0;
top: 0;
position: sticky;
display: block;
align-items: center;
justify-content: center;
text-align: center;
overflow: hidden;
z-index: 80;
}
.navbar .nav-btn {
margin-left: 30px;
padding: 0;
margin-top: 70px;
color: var(--text-color);
display:inline-block;
text-decoration: none;
font-family: 'montserrat';
font-weight: 600;
z-index: 81;
}
.navbar .nav-btn-first {
padding: 0;
margin-top: 70px;
color: var(--text-color);
display:inline-block;
text-decoration: none;
font-family: 'montserrat';
font-weight: 600;
z-index: 81;
}
.nav-logo {
font-family: 'adrippingmarker', Arial;
padding-top: 70px;
margin-left: 30px;
font-size: 75px;
text-decoration: none;
color: var(--text-color);
z-index: 81;
}
.nav-logo:hover {
background-image: url(../img/logo-hvr.gif);
background-size: cover;
color: transparent;
-moz-background-clip: text;
-webkit-background-clip: text;
-webkit-transition: transform 0.3s ease-in-out;
-moz-transition: transform 0.3s ease-in-out;
-ms-transition: transform 0.3s ease-in-out;
}
#intro-video-video, .intro-video, #intro-video-alternative {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
position: absolute;
left: 0px;
top: 0px;
padding: 0;
margin: 0;
z-index: -1;
}
#media only screen and (max-width: 683px) {
.nav-btn, .nav-btn-first {
display: none !important;
}
}
HTML:
<div class="navbar">
<a class="nav-btn-first" href="./gallery.php">Gallery</a> <a class="nav-btn" href="./meet-us.php">Our Team</a> <a class="nav-logo" href="./">misfits.</a> <a class="nav-btn" href="./contact.php">Contact Us</a> <a class="nav-btn" href="./social.php">Socials</a>
</div>
<div class="video-intro">
<video id="intro-video-video" autoplay loop muted>
<source src="./assets/video/bg.mp4" type='video/mp4'>
<img id="intro-video-alternative" src="alternative.jpg" />
</video>
</div>
<p> ljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkfljsfjsdhfjhsdkf
</p>
Demo: https://website.therealmisfits.repl.co/
Remove position: absolute from .video-intro and put it in .navbar.
Try this:
.navbar {
width: 100%;
text-align: center;
position: absolute;
top: 0;
}
.video-intro
{
width: 100%;
height: 100%;
object-fit: cover;
}
I want to make a CSS animation to open a transparent background from the center to the border (right and left) and leave the border red with text red and without any background.
Is it possible to do? I think I made a mistake with the class "bottone" but I don't know where!
The button needs to be like this, but with the colors inverted:
.bottone {
background: red;
box-sizing: border-box;
appearance: none;
color: #fff;
border: 2px solid red;
cursor: pointer;
display: inline-block;
position: relative;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
position: relative;
overflow: hidden;
z-index: 1;
transition: color 150ms ease-in-out;
}
.bottone:after {
content: '';
position: absolute;
display: block;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 0%;
height: 100%;
background: red;
z-index: -1;
transition: width 150ms ease-in-out;
}
.bottone:hover {
color: red;
}
.bottone:hover:after {
width: 110%;
}
<a class="bottone">example</a>
Here's another attempt:
.bottone {
background: transparent;
box-sizing: border-box;
appearance: none;
color: red;
border: 2px solid red;
cursor: pointer;
display: inline-block;
position: relative;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
position: relative;
overflow: hidden;
z-index: 1;
transition: color 150ms ease-in-out;
}
.bottone:after {
content: '';
position: absolute;
display: block;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 0%;
height: 100%;
background: red;
z-index: -1;
transition: width 150ms ease-in-out;
}
.bottone:hover {
color: #fff;
}
.bottone:hover:after {
width: 110%;
}
<a class="bottone">example</a>
Instead of "opening a transparent background", consider "moving two elements to reveal a transparent background". One idea is to use two pseudo-elements, :before and :after, that recede to opposite sides of the box.
In my example, one is left:0 and the other is right:0.
Their widths both transition from 50% to 0.
body {
background-color: lightgreen;
}
.bottone {
background: transparent;
box-sizing: border-box;
appearance: none;
color: white;
border: 2px solid red;
cursor: pointer;
display: inline-block;
position: relative;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
position: relative;
overflow: hidden;
z-index: 1;
transition: color 150ms ease-in-out;
}
.bottone:hover {
color: red;
}
.bottone:before,
.bottone:after {
content: '';
position: absolute;
display: block;
top: 0;
width: 50%;
height: 100%;
background: red;
z-index: -1;
transition: width 150ms ease-in-out;
}
.bottone:before {
left: 0;
}
.bottone:after {
right: 0;
}
.bottone:hover:before,
.bottone:hover:after {
width: 0;
}
<a class="bottone">example</a>
Color need to be swapped.
pseudo size needs also to be set and reset on hover.
CSS commented
.bottone {
background: transparent;
box-sizing: border-box;
appearance: none;
color: white;/* inverted*/
border: 2px solid red;
cursor: pointer;
display: inline-block;
position: relative;
align-self: center;
font-size: 1rem;
font-weight: 400;
line-height: 1;
margin: 20px;
padding: 1.2em 2.8em;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
position: relative;
overflow: hidden;
z-index: 1;
transition: color 150ms ease-in-out;
}
.bottone:after {
content: '';
position: absolute;
display: block;
top: 0;
left: 50%;
width: 0%;
height: 100%;
width: 110%;/* moved here */
background: red;
transform: translateX(-50%);
z-index: -1;
transition: width 150ms ease-in-out;
}
.bottone:hover {
color: red;/* inverted */
}
.bottone:hover:after {
width: 0;/* reset here */
}
<a class="bottone">example</a>
I wanted to know a few things:
1)How to get the circular profile image on the right-most side to get in the header and not be out of it?
2)How to Align the Last Three Images on the bottom(in "R" class) properly and have spacing between them while keeping care of the cropping?
I am adding a Fiddle here: https://jsfiddle.net/cLbfnu7p/1/
Code:
<div class="header">
<div class="nav-container">
<div class="logo"><img src="Images/logo.png" height="75px" width="auto"></div>
<div class="menu">
<ul class="menu-ul">
<li>Home</li>
<li>Login</li>
<li>Contact</li>
<li>Store</li>
<li>Buy</li>
</ul>
</div>
<div class="user-details">
<div class="profile_pic">
<div class="img_cont_pro">
<img src="Images/pro_pic.png">
</div>
</div>
</div>
</div>
</div>
<div class="section-divider">-<p>STUDIO</p></div>
<div class="showcase">
<div class="R">
<div class="r1"><img src="Images/Random/one.jpg" width="400px" height="auto"></div>
<div class="r1"><img src="Images/Random/two.jpg" width="400px" height="auto"></div>
</div>
<div class="R">
<div class="r2 c"><img src="Images/Random/three.jpg" width="400px" height="225px"></div>
<div class="r2 c2"><img src="Images/Random/four.jpg" width="auto" height="140px"></div>
<div class="r2 c3"><img src="Images/Random/five.jpg" width="auto" height="140px"></div>
</div>
</div>
Edit
html,body{
max-width: 100%;
overflow-x: hidden;
}
body{
//background-image: url("../Images/Design.png");//opacity: 0.4;
background-color: #ededed;
background-size: 1600px auto;
font-family: 'Roboto',sans-serif;
margin: 0;
padding: 0;
}
.header{
background-color: #FFFFFF;
width: 100%;
height: 123px;
text-align: center;
font-family: 'TypographLight';
border-bottom: 1px solid #B0B0B0;
}
.header .logo{
padding: 25px;
padding-left:44px;
float: left;
}
.header .menu li{
display: inline;
}
.header .menu a:hover{
color: #000000;
text-decoration: underline;
}
.header .menu{
display: inline-block;
margin-right: 230px;
}
.header ul {
padding: 10px;
margin-top: 0px;
}
.header .menu a {
color: #777777;
font-size: 23px;
text-decoration: none;
line-height: 114px;
padding:11px;
}
.header .menu .active {
color: #000000;
}
.image-slideshow .container-text {
font-family: CodeBold;
color: white;
left: 0;
position: absolute;
top: 34%;
width: 100%;
}
.image-slideshow .container-text .heading{
font-size: 97px;
}
.image-slideshow .container-text .sub-heading{
font-size: 20px;
font-family: 'TypographLight';
}
.container-slide{
position:relative;
text-align:center;
}
.container-slide img{
margin-top: -5px;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.image-slideshow .container-text .img-button{
margin-top: 20px;
font-family: 'TypographLight';
background-color:rgba(112,112,112,.7);
border:2px solid #DBDBDB;
color: #FFFFFF;
cursor: pointer;
border-radius: 4px;
outline: none;
width: 150px;
height: 40px;
font-size: 15px;
-webkit-transition:all 0.2s;
transition-timing-function: ease-in;
}
.image-slideshow .container-text .img-button:hover{
background-color:rgba(67,67,67,.7);
-webkit-transition:all 0.2s;
border:2px solid #CDCDCD;
transition-timing-function: ease-out;
}
#font-face{
font-family: TypographLight;
src: url('../Fonts/TYPOGRAPH PRO Light.ttf');
}
#font-face{
font-family: CodeBold;
src: url('../Fonts/CODE Bold.otf');
}
.section-divider{
text-align: center;
font-style: 'Roboto';
font-size: 40px;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
margin-top: -7px;
}
.section-divider p{
font-size: 20px;
margin-top: 4px;
}
.showcase{
max-width: 1200px;
text-align: center;
margin: auto;
}
.showcase img{
-webkit-filter:grayscale(40%);
-webkit-transition:all 0.2s;
transition-timing-function: ease-in;
}
.showcase img:hover{
-webkit-filter:grayscale(0%);
-webkit-transition:all 0.2s;
transition-timing-function: ease-in;
}
.r1{
display: inline;
}
.r2{
display: inline;
}
.R{
display: block;
}
.c{
left: 390px;
position: absolute;
margin-top: -50px;
clip:rect(50px,400px,190px,0px);
}
.c2{
position: absolute;
left: 945px;
}
.c3{
position: absolute;
left: 793px;
}
.header .img_cont_pro img{
display: inline;
margin: 0 auto;
height: 150%;
width: auto;
}
.header .img_cont_pro{
width: 40px;
height: 40px;
position: relative;
overflow: hidden;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
float: right;
}
.user-details{
margin-right: 2%;
padding-top: none;
margin-top: none;
overflow: hidden;
}
Thanks A Lot
For number 1 you should move the user-details div block to after the logo but before the menu. I would then make padding-top:40px;.
For both padding and margin you cant use none as that isnt allowed you should use 0 if you dont want it to have any visible margin or padding.
You should be using inspect element developer tools (right click menu in chrome if you're using that) to look at your code and you would see this and get a better understanding of what the code is doing and where its positioning on the page.
Also for your second point why have you made the images in two different divs with class 'R' (you should call your classes better names that make sense and allude to what they do) and in the second div you have used a new class on the images:
.c {
left: 390px;
position: absolute;
margin-top: -50px;
clip: rect(50px,400px,190px,0px);
}
This is whats making them not line up with the top 2 images. Plus r1 and r2 classes are both the same so no need for them unless you plan to add extra styling to one of them.
In regards to the 3rd point not sure what you are asking for. A dropdown menu? Hover styles? On click animations of some kind?
Project
adding circles that expands when users hover, on an image so it adds interesting animation to it.
Problem
After I was done I realized that depending on the screen display used, the elements (red balls) I put over the image are in different locations. How can I do this so it works on all devices except mobile.
You will get a better idea of what im doing when you see the demo
HTML
<div><img class="tree" title="source: imgur.com" src="http://i.imgur.com/1dDCOyq.png" alt="" />
<div class="circle-top-left">
<div class="circle__wrapper">
<div class="circle__content">
<p class="para">This is where sentence goes</p>
consulting 1
</div>
</div>
</div>
<div class="circle-top-right">
<div class="circle__wrapper">
<div class="circle__content">
<p class="para">This is where sentence goes</p>
consulting 3
</div>
</div>
</div>
<div class="circle-bot-right">
<div class="circle__wrapper">
<div class="circle__content">
<p class="para">This is where sentence goes</p>
consulting
</div>
</div>
</div>
<div class="circle-bot-left">
<div class="circle__wrapper">
<div class="circle__content">
<p class="para">This is where sentence goes</p>
consulting 4
</div>
</div>
</div>
</div>
CSS
.footer_top_holder {
border-top: #17171A solid 8px;
box-shadow: none;
}
/* Home page tree image CSS */
* {
box-sizing: border-box;
}
.tree {
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 50px;
margin-top: 50px;
}
.circle-top-left {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
font-size: 9px;
-webkit-backface-visibility: hidden;
position: absolute;
background: #b20312;
top: 103.5px;
left: 26.3%;
width: 60px;
height: 60px;
border-radius: 50%;
transition: all .5s ease-in-out;
margin: 0 0;
text-align: center;
}
.circle-top-left:hover {
width: 200px;
height: 200px;
padding: 2.5em;
color: transparent;
left: 160px;
top: 45px;
}
.circle-top-right {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
font-size: 9px;
-webkit-backface-visibility: hidden;
position: absolute;
background: #b20312;
top: 49.5px;
left: 52.5%;
width: 60px;
height: 60px;
border-radius: 50%;
transition: all .5s ease-in-out;
margin: 0 0;
text-align: center;
}
.circle-top-right:hover {
width: 200px;
height: 200px;
padding: 2.5em;
color: transparent;
left: 49%;
top: 35px;
}
.circle-bot-right {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
font-size: 9px;
-webkit-backface-visibility: hidden;
position: absolute;
background: #b20312;
top: 267.5px;
left: 75%;
width: 60px;
height: 60px;
border-radius: 50%;
transition: all .5s ease-in-out;
margin: 0 0;
text-align: center;
}
.circle-bot-right:hover {
width: 200px;
height: 200px;
padding: 2.5em;
color: transparent;
left: 74%;
top: 215px;
}
.circle-bot-left {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
font-size: 9px;
-webkit-backface-visibility: hidden;
position: absolute;
background: #b20312;
top: 379px;
left: 19.6%;
width: 60px;
height: 60px;
border-radius: 50%;
transition: all .5s ease-in-out;
margin: 0 0;
text-align: center;
}
.circle-bot-left:hover {
width: 200px;
height: 200px;
padding: 2.5em;
color: transparent;
left: 8%;
top: 320px;
}
.circle__wrapper {
display: table;
width: 100%;
height: 100%;
}
.title_subtitle_holder {
display: block;
padding: 30px 0;
position: relative;
}
.circle__content {
display: table-cell;
padding: 1em;
vertical-align: middle;
}
.para {
line-height: 25px;
display: none;
font-size: 15px;
color: white;
text-align: center;
vertical-align: middle;
}
.circle-top-right:hover .para,
.circle-bot-right:hover .para,
.circle-top-left:hover .para,
.circle-bot-left:hover .para {
display: block;
}
.circle-top-right:hover span,
.circle-bot-right:hover span,
.circle-top-left:hover span,
.circle-bot-left:hover span {
display: none;
}
Demo
You can get your element circles to start out on top of the image's circles by replacing your hard-coded left styles with the following:
.circle-top-left {
left: calc(50% - 260px);
}
.circle-top-right {
left: calc(50% + 29px);
}
.circle-bot-right {
left: calc(50% + 275px);
}
.circle-bot-left {
left: calc(50% - 335px);
}
CodePen 1
If you want the circles to always expand in place, replace your hard-coded left and top hover styles with the following:
.circle-top-left:hover, .circle-top-right:hover,
.circle-bot-right:hover, .circle-bot-left:hover {
transform: translate(-90px, -90px);
}
CodePen 2
All right? I'm having problems with an effect on CSS. Everything works perfectly until I put the code inside another div, and has a background that is not transparent. Look at the example below:
body {
background: #2ecc71;
padding:0;
margin:0;
}
#bg{
background: #000;
}
.container-button {
padding: 10em;
margin: 0 auto;
width: 1170px;
text-align: center;
display: block;
overflow: hidden;
}
/* GENERAL BUTTON STYLING */
.btn-more-info{
display:block;
overflow: hidden;
text-align: center;
display: inline-block;
float: left;
}
.btn-more-info a,
.btn-more-info a::after {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
test-ident: -9999px;
text-decoration: none;
}
.btn-more-info a {
background: none;
border: 2px solid #fff;
border-radius: 5px;
color: #fff;
display: block;
font-size: 14px;
font-weight: bold;
padding: 20px 50px;
position: relative;
text-transform: uppercase;
}
.btn-more-info a::before,
.btn-more-info a::after {
background: #fff;
content: '';
position: absolute;
z-index: -1;
}
.btn-more-info a:hover {
color: #2ecc71;
}
/* BUTTON EFFECT */
.btn-effect {
overflow: hidden;
}
.btn-effect::after {
/*background-color: #f00;*/
height: 100%;
left: -35%;
top: 0;
transform: skew(50deg);
transition-duration: 0.6s;
transform-origin: top left;
width: 0;
}
.btn-effect:hover:after {
height: 100%;
width: 135%;
}
.btn-send{
overflow: hidden;
text-align: center;
clear: both;
}
.btn-send a,
.btn-send a::after {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
test-ident: -9999px;
text-decoration: none;
}
.btn-send a {
background: none;
border: 2px solid #353B4C;
border-radius: 5px;
color: #353B4C;
display: inline-block;
font-size: 14px;
font-weight: bold;
padding: 20px 50px;
position: relative;
text-transform: uppercase;
}
.btn-send a::before,
.btn-send a::after {
background: #353B4C;
content: '';
position: absolute;
z-index: -1;
}
.btn-send a:hover {
color: #FFF;
}
<div id="bg">
<div class="container-button">
<div class="btn-more-info">
Continue lendo
</div>
<div class="btn-send">
Enviar mensagem
</div>
</div>
</div>
You see, if you remove the id="bg" effect functions normally.
Can anyone help me?
Thank U!
The problem is on the z-index of the :before and :after.
Try this:
.btn-more-info a::before,
.btn-more-info a::after {
background: #fff;
content: '';
position: absolute;
z-index: 0;
}
Also increase the z-index on the text inside the button.