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;
}
Related
When I try to set the position of a button as "relative" in this specific web.
the width of the page gets increased as you can see by the code provided in snippet, will appreciate if you take a look (Specifically "btn-links1 & btn-links2" classes)
(Absolute value doesn't work as the buttons get misplaced when minimizing the browser window)
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--main-color: #00C9A6;
--second-color: #27242B;
--third-color: #545058;
--fourth-color: #FAEAFF;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--third-color);
font-family: 'Roboto', sans-serif;
}
.nav-bar {
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
display: flex;
position: fixed;
padding: 15px;
/* background-color: var(--second-color); */
width: 100%;
height: 60px;
z-index: 1030;
}
.active {
border-bottom: 1px solid var(--fourth-color);
}
.logo {
position: relative;
bottom: 4px;
height: 40px;
display: inline-block;
background-color: var(--fourth-color);
transition: .2s;
}
.logo img {
width: 50px;
}
.logo:hover {
opacity: .5;
}
.nav-bar .links li {
padding: 7px;
display: inline-block;
justify-content: space-around;
}
.nav-bar .links {
left: 30px;
position: relative;
/* margin: 10px 0; */
}
.nav-bar .links li a {
list-style: none;
text-decoration: none;
margin-top: 15px;
padding: 0 15px 0 15px;
color: var(--main-color);
text-transform: capitalize;
font-weight: 700;
transition: .2s ease-in-out;
}
.nav-bar .links li:hover a {
color: #00c9a7b9;
}
#home {
position: relative;
width: 100%;
height: 500px;
background-color: var(--third-color);
z-index: 1;
}
.img{
background-image: url(../imgs/Dustin+vs+Claudio_.jpg);
position: absolute;
background-size: cover;
width: 100%;
height: 500px;
z-index: 2;
}
.overlay {
position: absolute;
width: 100%;
height: 500px;
background-color: rgba(33, 31, 35, 0.569);
z-index: 3;
}
.titles h1 {
position: absolute;
font-size: 100px;
font-style: italic;
color: var(--main-color);
z-index: 4;
text-align: center;
top: 0;
left: 170px;
margin: 155px 0;
padding: 5px;
text-transform: capitalize;
}
/* start Button styling */
.btn-link1 {
position: relative;
left: 297px;
bottom: 208px;
text-decoration: none;
}
.btn-link1 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-86 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-86::after,
.button-86::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-86::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-86::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-86:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-86:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-86:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link1 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link1:hover a span {
/* font-weight: bold; */
color: black;
}
.btn-link1:hover .fa-instagram {
color: black;
}
.fa-instagram {
/* font-weight: bold; */
color: rgb(120, 5, 221);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button instagram styling */
/* start Button linked in styling */
.btn-link2 {
position: relative;
left: 575px;
bottom: 208px;
text-decoration: none;
}
.btn-link2 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-87 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-87::after,
.button-87::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-87::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-87::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-87:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-87:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-87:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link2 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link2:hover a span {
/* font-weight: bold; */
color: rgb(0, 162, 255);
}
.btn-link2:hover .fa-linkedin {
color: black;
}
.fa-linkedin {
color: rgb(0, 162, 255);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button linked in styling */
<div class="nav-bar">
<a class="logo" href="#home">
<img src="imgs/lw-logo.png" alt="">
</a>
<ul class="links">
<li class="active">home</li>
<li>portraits</li>
<li>behind the scenes</li>
<li>action</li>
<li>fine art</li>
<li>contact me</li>
</ul>
</div>
<div id="home">
<div class="background">
<div class="img"></div>
<div class="overlay"></div>
</div>
<div class="titles">
<h1>lw photography</h1>
</div>
</div>
<div class="btn-link1">
<a href="https://www.instagram.com">
<button class="button-86" role="button">
<i class="fa-brands fa-instagram"></i>
<span>Instagram</span>
</button>
</a>
</div>
<div class="btn-link2">
<a href="https://www.linkedin.com/in/lane-walbert-0b838a9a/">
<button class="button-87" role="button">
<i class="fa-brands fa-linkedin"></i>
<span>LinkedIn</span>
</button>
</a>
</div>
Scroll bar down bottom as page width got increased
Below is the pen where i test this code.But i dont know where is the issues in the code.
Here is the pen link where i put this code.
https://codepen.io/codeslide/pen/xvRomW
Is anyone help with this issue i am new in this but keep try to do better.
The strip is not close when i click the dismiss button.
Thanks for your Suggesstion.
Built in html and css.
CSS code
.headerstrip-wrapper {
height: 50px;
position: relative;
}
.headerstrip-wrapper .headerstrip__banner-dismiss {
width: 12px;
height: 12px;
background: none;
border: none;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
padding: 0;
position: absolute;
font: inherit;
height: 100%;
line-height: 0;
cursor: pointer;
outline: inherit;
opacity: 0.4;
padding: 0 16px;
color: white;
text-decoration: none;
-webkit-transition: all 100ms ease;
-moz-transition: all 100ms ease;
-o-transition: all 100ms ease;
transition: all 100ms ease;
right: 0;
top: 0;
z-index: 2;
}
.headerstrip-wrapper .headerstrip__banner-dismiss:hover {
-webkit-transform: scale(1.3);
transform: scale(1.3);
}
.headerstrip-wrapper .headerstrip__banner-dismiss svg {
fill: #000000;
}
.headerstrip {
display: block;
height: 50px;
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”,sans-serif;
font-size: 14px;
position: relative;
text-decoration: none;
z-index: 1;
}
.headerstrip .headerstrip-content-background {
background-color: #fff;
opacity: 1;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #2930b4; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(left, #2930b4, #2a9eb0); /* For Safari 5.1 to 6.0 */
background: linear-gradient(to right, #2930b4, #2a9eb0); /* Standard syntax */
background-repeat: repeat-x;
}
.headerstrip .headerstrip-canvas {
height: 50px;
margin: auto auto;
}
.headerstrip .headerstrip-content {
display: flex;
align-items: center;
justify-content: center;
background-size: contain;
background-repeat: no-repeat;
background-size: 1000px 50px;
width: 100%;
height: 50px;
max-width: 1408px;
padding-left: 16px;
padding-right: 16px;
margin: 0 auto;
}
.headerstrip .headerstrip-text {
color: #FFFFFF;
text-decoration: none;
padding-right: 24px;
font-weight: 200;
letter-spacing: 0.8px;
position: relative;
}
.headerstrip .headerstrip-text strong {
font-weight: 600;
}
.headerstrip .headerstrip-cta-container {
display: flex;
}
.headerstrip .headerstrip-cta {
position: relative;
background-color: #FC9F97;
padding: 5px 30px;
color: #2d2d2d;
font-weight: 600;
border-radius: 4px;
text-decoration: none;
display: block;
text-align: center;
min-width: 100px;
}
.headerstrip .headerstrip-cta-mobile {
color: #FFFFFF;
text-decoration: underline;
padding-left: 5px;
}
.headerstrip .headerstrip-cta-mobile:hover {
color: #FFFFFF;
}
.headerstrip .is-hidden-desktop .headerstrip-content {
text-align: center;
}
.headerstrip .is-hidden-desktop .headerstrip-text {
position: relative;
padding-right: 24px;
}
.headerstrip .is-hidden-desktop .headerstrip__banner-dismiss {
margin-left: 0;
}
.headerstrip .headerstrip__dismiss-icon {
width: 12px;
height: 12px;
fill: #FFFFFF;
display: inline-block;
}
#media (max-width: 1024px) {
.headerstrip .is-hidden-tablet-and-below {
display: none !important;
}
}
#media (min-width: 1025px) {
.headerstrip .is-hidden-desktop {
display: none !important
}
}
<strong>Html code</strong>
<div class="banner-root">
<div class="banner-container">
<div class="headerstrip-wrapper">
<button title="dismiss" type="button" class="js-banner__dismiss headerstrip__banner-dismiss">
<svg class="headerstrip__dismiss-icon" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M19.8 2.4c.3.3.3.8 0 1.1l-6 6c-.3.3-.3.8 0 1.1l6 6c.3.3.3.8 0 1.1l-2.2 2.2c-.3.3-.8.3-1.1 0l-6-6c-.3-.3-.8-.3-1.1 0l-6 6c-.3.3-.8.3-1.1 0L.1 17.7c-.3-.3-.3-.8 0-1.1l6-6c.3-.3.3-.8 0-1.1l-6-6c-.3-.3-.3-.8 0-1.1L2.3.2c.3-.3.8-.3 1.1 0l6 6c.3.3.8.3 1.1 0l6-6c.3-.3.8-.3 1.1 0l2.2 2.2z"></path>
</svg>
</button>
<a class="headerstrip js-banner__link" href="https://market.codeslide.in/">
<div class="headerstrip-content-background"></div>
<div class="headerstrip-canvas is-hidden-desktop">
<div class="headerstrip-content">
<div class="headerstrip-text">
Codeslide!
<span class="js-banner__link headerstrip-cta-mobile" href="https://market.codeslide.in/">From $0.00/m</span>
</div>
</div>
</div>
<div class="headerstrip-canvas is-hidden-tablet-and-below">
<div class="headerstrip-content">
<div class="headerstrip-text">
<strong>Codeslide!</strong> Unlimited plugin, WordPress & web template downloads!
</div>
<span class="js-banner__link headerstrip-cta" href="https://market.codeslide.in/">From $0.00/m</span>
</div>
</div>
</a>
</div>
</div>
</div>
You forgot to add the below script in your code.
var closeButtons = $('.headerstrip__banner-dismiss');
closeButtons.on('click', function() {
$(this).parent().hide();
});
Here is the snippet:
.headerstrip-wrapper {
height: 50px;
position: relative;
}
.headerstrip-wrapper .headerstrip__banner-dismiss {
width: 12px;
height: 12px;
background: none;
border: none;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
padding: 0;
position: absolute;
font: inherit;
height: 100%;
line-height: 0;
cursor: pointer;
outline: inherit;
opacity: 0.4;
padding: 0 16px;
color: white;
text-decoration: none;
-webkit-transition: all 100ms ease;
-moz-transition: all 100ms ease;
-o-transition: all 100ms ease;
transition: all 100ms ease;
right: 0;
top: 0;
z-index: 2;
}
.headerstrip-wrapper .headerstrip__banner-dismiss:hover {
-webkit-transform: scale(1.3);
transform: scale(1.3);
}
.headerstrip-wrapper .headerstrip__banner-dismiss svg {
fill: #000000;
}
.headerstrip {
display: block;
height: 50px;
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”,sans-serif;
font-size: 14px;
position: relative;
text-decoration: none;
z-index: 1;
}
.headerstrip .headerstrip-content-background {
background-color: #fff;
opacity: 1;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #2930b4; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(left, #2930b4, #2a9eb0); /* For Safari 5.1 to 6.0 */
background: linear-gradient(to right, #2930b4, #2a9eb0); /* Standard syntax */
background-repeat: repeat-x;
}
.headerstrip .headerstrip-canvas {
height: 50px;
margin: auto auto;
}
.headerstrip .headerstrip-content {
display: flex;
align-items: center;
justify-content: center;
background-size: contain;
background-repeat: no-repeat;
background-size: 1000px 50px;
width: 100%;
height: 50px;
max-width: 1408px;
padding-left: 16px;
padding-right: 16px;
margin: 0 auto;
}
.headerstrip .headerstrip-text {
color: #FFFFFF;
text-decoration: none;
padding-right: 24px;
font-weight: 200;
letter-spacing: 0.8px;
position: relative;
}
.headerstrip .headerstrip-text strong {
font-weight: 600;
}
.headerstrip .headerstrip-cta-container {
display: flex;
}
.headerstrip .headerstrip-cta {
position: relative;
background-color: #FC9F97;
padding: 5px 30px;
color: #2d2d2d;
font-weight: 600;
border-radius: 4px;
text-decoration: none;
display: block;
text-align: center;
min-width: 100px;
}
.headerstrip .headerstrip-cta-mobile {
color: #FFFFFF;
text-decoration: underline;
padding-left: 5px;
}
.headerstrip .headerstrip-cta-mobile:hover {
color: #FFFFFF;
}
.headerstrip .is-hidden-desktop .headerstrip-content {
text-align: center;
}
.headerstrip .is-hidden-desktop .headerstrip-text {
position: relative;
padding-right: 24px;
}
.headerstrip .is-hidden-desktop .headerstrip__banner-dismiss {
margin-left: 0;
}
.headerstrip .headerstrip__dismiss-icon {
width: 12px;
height: 12px;
fill: #FFFFFF;
display: inline-block;
}
#media (max-width: 1024px) {
.headerstrip .is-hidden-tablet-and-below {
display: none !important;
}
}
#media (min-width: 1025px) {
.headerstrip .is-hidden-desktop {
display: none !important
}
}
<strong>Html code</strong>
<div class="banner-root">
<div class="banner-container">
<div class="headerstrip-wrapper">
<button title="dismiss" type="button" class="js-banner__dismiss headerstrip__banner-dismiss">
<svg class="headerstrip__dismiss-icon" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M19.8 2.4c.3.3.3.8 0 1.1l-6 6c-.3.3-.3.8 0 1.1l6 6c.3.3.3.8 0 1.1l-2.2 2.2c-.3.3-.8.3-1.1 0l-6-6c-.3-.3-.8-.3-1.1 0l-6 6c-.3.3-.8.3-1.1 0L.1 17.7c-.3-.3-.3-.8 0-1.1l6-6c.3-.3.3-.8 0-1.1l-6-6c-.3-.3-.3-.8 0-1.1L2.3.2c.3-.3.8-.3 1.1 0l6 6c.3.3.8.3 1.1 0l6-6c.3-.3.8-.3 1.1 0l2.2 2.2z"></path>
</svg>
</button>
<a class="headerstrip js-banner__link" href="https://market.codeslide.in/">
<div class="headerstrip-content-background"></div>
<div class="headerstrip-canvas is-hidden-desktop">
<div class="headerstrip-content">
<div class="headerstrip-text">
Codeslide!
<span class="js-banner__link headerstrip-cta-mobile" href="https://market.codeslide.in/">From $0.00/m</span>
</div>
</div>
</div>
<div class="headerstrip-canvas is-hidden-tablet-and-below">
<div class="headerstrip-content">
<div class="headerstrip-text">
<strong>Codeslide!</strong> Unlimited plugin, WordPress & web template downloads!
</div>
<span class="js-banner__link headerstrip-cta" href="https://market.codeslide.in/">From $0.00/m</span>
</div>
</div>
</a>
</div>
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script>
var closeButtons = $('.headerstrip__banner-dismiss');
closeButtons.on('click', function() {
$(this).parent().hide();
});
</script>
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>
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 am able to display two span text elements over the image when I hover over with my cursor successfully. But I am having trouble placing a button that is centered over the image, below the project name. Any help would be appreciated. I should also note the button that I want to use is from a Bootstrap 3 class.
Here is a demo: https://jsfiddle.net/oo1xx006/3/
Here is an example of what I want to create: http://www.devonstank.com/
HTML:
<div class="latest_projects">
<!-- My latest projects -->
<h1>My latest projects</h1>
<br>
<ul class="projects-list">
<li>
<img src="img/mudmat-global-model.jpg" alt="DOF Mudmat Lowering" width="380px" height="380px"/>
<span class="text-content">
<span class="project-type"><i>Project Type</i></span>
<span class="project-name">Project Name</span>
<!-- <span>View project</span> -->
</span>
</li>
</ul>
<br>
View more projects
</div>
CSS:
body {
padding-top: 0;
font-family: 'PT Sans', sans-serif;
background-color: white;
}
h1 {
/* margin: 15px 0;*/
font-size: 1.9em;
font-weight: normal;
color: #000;
line-height: 120%;
text-align: center;
}
h2 {
font-size: 1.3em;
margin: -5px 0 0;
font-weight: normal;
color: #000;
text-align: center;
}
a {
text-decoration: none;
color: #000;
font-weight: bold;
}
a:hover {
text-decoration: none;
}
p {
line-height: 200%;
padding: 0 10% 0 10%;
font-size: 1.1em;
text-align: center;
}
.btn-default {
border-color: #000;
border-radius: 0;
border-width: 2px;
color: #000;
font-size: 1.5em;
}
.btn-default:hover {
color: #fff;
background-color: #000;
border-color: #000;
border-radius: 0;
border-width: 2px;
}
img {
max-width: 100%;
}
/************************************
HOME
************************************/
.latest_projects {
text-align: center;
max-width: 1200px;
margin: 0 auto;
}
.latest_projects p {
margin: 0;
color: transparent;
}
.fluid-container img {
height: 350px;
width: 350px;
margin-bottom: 20px;
vertical-align: middle;
}
/*******Project Images******/
ul.projects-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.projects-list li {
display: inline-block;
height: 380px;
position: relative;
width: 380px;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
}
span.text-content span {
display: table-cell;
text-align: center;
vertical-align: middle;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
}
ul.projects-list li:hover span.text-content {
opacity: 1;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
span.project-type {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 120px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
span.project-name {
font-size: 2.5em;
}
span.view-project {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 10px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
You can do that with Javascript. Basically you have a container, inside which you need to see/use extra content if you hover on it. I suggest that you should add the needed html, but with display: none; CSS rule, and then you need to show it when the user hovers the container and hide it if the use leaves the container. This is how you can do it with jQuery:
$(".yourcontainerclass").mouseenter(function() {
$(this).find(".yourinnerclass").hide();
});
$(".yourcontainerclass").mouseout(function() {
$(this).find(".yourinnerclass").show();
});