The text wont display on-top of the video.
I am basically wanting a title which i called Heading to display overlaid on the video. I have tried fiddling with z-index and it does not change, i did notice when I replace the video for an image the text worked, that was using different css code, I am assuming their is a problem with the css.
Please help me, THANK YOU.
CSS CODE:
.home-subheading {
font-family: 'Montserrat',sans-serif;
font-size: 14px;
letter-spacing: .5px;
font-weight: 400;
color: #ccc;
z-index:999!important;
}
.tp-banner .home-subheading {
line-height: 40px!important;
#home-revolution-slider {
width: 100%;
height: 100%;
min-height: 100%;
z-index: -99;
}
.hero {
position: fixed;
z-index: -99;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-size: cover;
}
.content {
position: relative;
z-index: 3;
background-color: #fff;
}
.home-heading,
.home-subheading,
.home-button {
position: absolute;
z-index: 999;
text-align: center;
transform: translateY(0px);
/*-webkit-transition: 1s opacity ease-in-out;*/
}
.tp-loader.spinner1 {
width: 40px;
height: 40px;
background: url(../img/assets/rev-loader.gif) no-repeat center center;
background-color: transparent;
box-shadow: none;
-webkit-box-shadow: none;
margin-top: -20px;
margin-left: -20px;
-webkit-animation: none;
animation: none;
border-radius: 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
}
.tp-banner-container{
width:100%;
position:relative;
padding:0;
margin-top: 0;
z-index: -1;
}
.tparrows.preview4:after {
background: #fff;
background: rgba(255,255,255,.05);
}
.tp-caption a {
color: #fff;
padding: 9px 22px;
box-shadow: 0 -3px rgba(0, 0, 0, 0.3) inset;
-moz-box-shadow: 0 -3px rgba(0, 0, 0, 0.3) inset;
-webkit-box-shadow: 0 -3px rgba(0, 0, 0, 0.3) inset;
-o-box-shadow: 0 -3px rgba(0, 0, 0, 0.3) inset;
margin: 0 7px 0 7px;
text-transform: uppercase;
}
.tp-caption a:hover {
color: #fff;
}
.html5-video-container video {
width: 100%!important;
height: auto!important;
left: 0!important;
z-index: -99;
}
.tp-banner-video video{
min-width: 100%;
z-index: -3;
HTML CODE:
<!-- MAIN IMAGE -->
<video src="img/coding.mp4" autoplay loop alt="video_typing_cover" data-bgposition="center center" data-bgfit="cover" data-bgrepeat="repeat"></video>
<!-- LAYERS -->
<!-- Home Heading -->
<div class="tp-caption sft"
data-x="center"
data-y="260"
data-speed="1200"
data-start="1100"
data-easing="Power3.easeInOut"
data-splitin="none"
data-splitout="none"
data-endspeed="300"
style="z-index: 4; max-width: auto; max-height: auto; white-space:normal;">
<h2 class="home-heading op-1">Digital Hive</h2>
</div>
<!-- LAYER NR. 1 -->
<div class="tp-caption tp-fade fadeout fullscreenvideo"
data-x="0"
data-y="0"
data-speed="1000"
data-start="1100"
data-easing="Power4.easeOut"
data-elementdelay="0.01"
data-endelementdelay="0.1"
data-endspeed="1500"
data-endeasing="Power4.easeIn"
data-autoplay="true"
data-autoplayonlyfirsttime="false"
data-nextslideatend="true"
data-volume="mute"
data-forceCover="1"
data-aspectratio="16:9"
data-forcerewind="on"
style="z-index: 2;">
<video class="img-responsive" preload="none"
poster='example'>
<source src='img/coding.mp4' autoplay type='video/mp4' />
</video>
</div>
Related
I would like to custom my profile pic like in this picture but I can't, don't know what's wrong.
I have an external bootstrap CSS file though. What I want to follow the Facebook profile pice update design but facing small issue, I have attached a pic to see how I want it
HTML
<div class="user-thumb user-thumb--edit">
<div class="custom-file">
<input class="custom-file__input" id="photo" accept="image/*" type="file">
<label class="custom-file__label" for="photo">
<img alt="" class="thumb--lg rounded-circle" src="">
</label>
</div>
</div>
Here is the CSS
.user-thumb {
position: relative;
display: inline-block;
background: #e9e9e9;
border-radius: 50%;
}
.user-thumb--edit {
position: relative;
margin-bottom: 1rem;
}
.custom-file {
margin: 0;
height: auto;
}
.custom-file__input {
position: absolute;
opacity: 0;
visibility: hidden;
width: 1px;
height: 1px;
}
.custom-file__label {
cursor: pointer;
border: 0;
text-align: center;
font-weight: 500;
font-size: 1rem;
display: block;
margin: 0;
border-radius: 0;
padding: 0;
background: transparent;
position: relative;
}
.user-thumb--edit .custom-file__label::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
text-align: center;
transition: all 0.15s ease-in-out;
z-index: 20;
background: #ffffff url();
background: 1.4rem auto;
width: 4.2rem;
height: 4.2rem;
border-radius: 100%;
box-shadow: 0px 6px 6px -3px rgb(0 0 0 / 20%), 0px 10px 14px 1px rgb(0 0 0 / 14%), 0px 4px 18px 3px rgb(0 0 0 / 12%);
}
You can achieve this if you set the border-radius of the label to 50% instead of 0 and add overflow: hidden, which would also hide a part of the ::before. Therefor you should define that ::before not for the label but for the containing div: .custom-file::before.
Working example:
.user-thumb {
position: relative;
display: inline-block;
background: #e9e9e9;
border-radius: 50%;
}
.user-thumb--edit {
position: relative;
margin-bottom: 1rem;
}
.custom-file {
margin: 0;
height: auto;
}
.custom-file__input {
position: absolute;
opacity: 0;
visibility: hidden;
width: 1px;
height: 1px;
}
.custom-file__label {
cursor: pointer;
border: 0;
text-align: center;
font-weight: 500;
font-size: 1rem;
display: block;
margin: 0;
border-radius: 50%;
padding: 0;
background: transparent;
position: relative;
overflow: hidden;
}
.user-thumb--edit .custom-file::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
text-align: center;
transition: all 0.15s ease-in-out;
z-index: 20;
background: #ffffff url();
background: 1.4rem auto;
width: 4.2rem;
height: 4.2rem;
border-radius: 100%;
box-shadow: 0px 6px 6px -3px rgb(0 0 0 / 20%), 0px 10px 14px 1px rgb(0 0 0 / 14%), 0px 4px 18px 3px rgb(0 0 0 / 12%);
}
<div class="user-thumb user-thumb--edit">
<div class="custom-file">
<input class="custom-file__input" id="photo" accept="image/*" type="file">
<label class="custom-file__label" for="photo">
<img alt="" class="thumb--lg rounded-circle" src="https://via.placeholder.com/150">
</label>
</div>
</div>
First of all excuse me for explanation if I am not up to the mark, as this is my first post in this platform, Well, I am working on overlay where it has to be shown in right side of the page with given width of say 416px and 100vh of height, but things are getting cut if I do decrease the browser window and as I am decreasing the size of the browser window the button at bottom start appearing on content of overlay which has to remain at bottom even the height is getting decreased, here is the my code as below:
.advanced-overlay {
width: 100%;
min-height: 100vh;
background-color: rgba(35, 0, 18, 0.5);
position: fixed;
z-index: 100002;
top: -41px;
left: 0;
bottom: 0;
.advance-overlay-footer {
display:flex;
justify-content: space-between;
align-items:center;
position: fixed;
right: 24px;
width:156px;
bottom: 24px;
height:6%;
}
.advanced-overlay-content {
position: relative;
// min-height: 83vh;
width: 416px;
margin-top: 108px;
margin-left: auto;
margin-right: 6px;
opacity: 1;
z-index: 100004;
border-radius: 16px 16px 16px 16px;
background-color: #f5f4f6;
box-shadow: 0 2px 30px 0 rgba(0, 0, 0, 0.07),
0 19px 18px 0 rgba(0, 0, 0, 0.05), 0 8px 12px 0 rgba(0, 0, 0, 0.05),
0 1px 5px 0 rgba(0, 0, 0, 0.04), 0 0 2px 0 rgba(0, 0, 0, 0.03);
.close-advance-overlay {
position: absolute;
background-color: #fff;
width: 110px;
height: 40px;
display: flex;
border-radius: 20px;
padding: 5px 22px;
top: -18px;
right: 155px;
opacity: 1;
cursor: pointer;
img {
height: 20px;
width: 20px;
align-self: center;
}
.button-text {
align-self: center;
margin-left: 5px;
font-weight: 600;
font-size: 16px;
color: #000000;
}
}
.advnaced-overlay-content-secion {
//min-height:89vh;
width: 100%;
bottom:10%;
// height:100vh;
.select-box {
margin-top: 40px;
margin-bottom: 40px;
}
.accordinan-filter {
margin-bottom: 24px;
}
.accordian-title {
font-weight: 900;
}
.accordian-content {
margin: 0;
font-size: 16px;
}
}
}
}
.is-maximum {
height: 73vh;
overflow-y: auto;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 4px;
background-color: #fff;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
background-color: #d3d3d3;
}
}
<div class="advanced-overlay" v-if="toggleFilter">
<div class="advanced-overlay-content">
<div class="close-advance-overlay" #click="toggleAdvanceFilterOverlay">
<img class src="../assets/icons/close.svg" />
<span class="button-text">Close</span>
</div>
<div class="advnaced-overlay-content-secion is-maximum">
<div class="select-box"></div>
<div class="accordinan-filter"></div>
</div>
<div class="advance-overlay-footer">...two buttons</div>
</div>
</div>
So, I what I would like to achieve eventually is that, I want respsonsive overlay at right side of the browser window, provided if I am decreasing height of the browser the buttons at bottom should stay there (fixed position) and content should be within limit of .advnaced-overlay-content-secion
for a responsive design I recommend you to read into the use of grid and espacially for mobile designs also the use of #media breakpoints.
for having some thing to stick at the bottom simply use:
position: fixed;
bottom: 0;
I'm trying to put an opaque layer above an image that also has responsive text on top of it. The opaque layer should be above the image, but below the text, and also not display upon hovering over the image.
My test page is here: https://www.gorgeous-geek.com/image-layer-test/
I tried to add a layer div, but can't find out how to do this to achieve the result I'm looking for.
Also, I don't manage to correctly right align the orange button with the right hand side of the image. It shows up in different places on Chrome and Safari.
Any help appreciated!
This is the code:
.containerbox {
position: relative;
color: white;
}
.top-left {
position: absolute;
top: 8%;
left: 0;
color: #000;
font-weight: 800;
background-color: #a79f9f;
padding: 6px 40px;
}
.bottom-right {
position: absolute;
bottom: 5%;
right: 17.5%;
color: #000;
font-weight: 800;
background: #de9104;
font-size: 14px;
padding: 4px 3%;
}
.bottom-right a {
color: white;
}
<div class="containerbox">
<img src="https://www.gorgeous-geek.com/wp-content/uploads/Laptop-on-desk-web-design.jpg" style="border: 1px solid #ececec;" alt="Laptop" style="width:100%;">
<div class="top-left">Top Left</div>
<div class="bottom-right">Read more</div>
</div>
</div>
You could use the image filter as shown below. As for the position of the read more button I don't know the result you're looking for.
.containerbox {
position: relative;
}
.containerbox img {
border: 1px solid #ececec;
width: 100%;
filter: opacity(50%);
transition: filter .5s ease-out;
}
.containerbox:hover img {
filter: opacity(100%);
}
.top-left {
position: absolute;
top: 8%;
left: 0;
color: #000;
font-weight: 800;
background-color: #a79f9f;
padding: 6px 40px;
}
.bottom-right {
position: absolute;
bottom: 5%;
right: 17.5%;
color: #000;
font-weight: 800;
background: #de9104;
font-size: 14px;
padding: 4px 3%;
}
.bottom-right a {
color: white;
}
<div class="containerbox">
<img src="https://www.gorgeous-geek.com/wp-content/uploads/Laptop-on-desk-web-design.jpg" alt="Laptop">
<div class="top-left">Top Left</div>
<div class="bottom-right">
Read more
</div>
</div>
Update
.containerbox {
position: relative;
}
.containerbox img {
border: 1px solid #ececec;
width: 100%;
}
.overlay {
position: absolute;
background: linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 59%, rgba(0, 0, 0, 0.65) 100%));
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(59%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0.65)));
background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 59%, rgba(0, 0, 0, 0.65) 100%);
z-index: 1;
height:100%;
top: 0;
left: 0;
width: 100%;
opacity: 100;
transition: opacity .5s ease-out;
}
.containerbox:hover .overlay {
opacity: 0;
}
.top-left {
position: absolute;
top: 8%;
left: 0;
color: #000;
font-weight: 800;
background-color: #a79f9f;
padding: 6px 40px;
z-index: 2;
}
.bottom-right {
position: absolute;
bottom: 5%;
right: 0;
color: #000;
font-weight: 800;
background: #de9104;
font-size: 14px;
padding: 4px 3%;
z-index: 2;
}
.bottom-right a {
color: white;
}
<div class="containerbox">
<img src="https://www.gorgeous-geek.com/wp-content/uploads/Laptop-on-desk-web-design.jpg" alt="Laptop">
<div class="overlay"></div>
<div class="top-left">Top Left</div>
<div class="bottom-right">
Read more
</div>
</div>
You can utilize the z-index property to control the way your elements are layered:
The z-index property specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order.
Note: z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky).
Source
Below, I created an overlay using the :after psuedo element of .containerbox, and I gave that overlay a z-index: 1. Then, I gave the elements I want to display above my overlay a z-index: 2:
.containerbox {
position: relative;
color: white;
}
.containerbox:after {
content: '';
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: white;
opacity: .5;
z-index: 1;
}
.top-left {
position: absolute;
top: 8%;
left: 0;
color: #000;
font-weight: 800;
background-color: #a79f9f;
padding: 6px 40px;
z-index: 2;
}
.bottom-right {
position: absolute;
bottom: 5%;
right: 17.5%;
color: #000;
font-weight: 800;
background: #de9104;
font-size: 14px;
padding: 4px 3%;
z-index: 2;
}
.bottom-right a {
color: white;
}
<div class="containerbox">
<img src="https://www.gorgeous-geek.com/wp-content/uploads/Laptop-on-desk-web-design.jpg" style="border: 1px solid #ececec;" alt="Laptop" style="width:100%;">
<div class="top-left">Top Left</div>
<div class="bottom-right">Read more</div>
</div>
EDIT: I ended up using the second solution here and It works wonderfully. Thanks everyone who helped me solve this issue
I have an image declared in a css file like background:url(). The css file is the 2nd thing on the page to load, but the image is the last thing. This image is the first thing people will see on the site, but it loads last. Is there any way to load this image as soon as the page starts loading?
Edit:
$(document).ready(function() {
resizeDiv();
});
window.onresize = function(event) {
resizeDiv();
}
function resizeDiv() {
vpw = $(window).width();
vph = ($(window).height());
$('#mainPic').css({
'height': vph + 'px'
});
$('#mainPicContent').css({
'height': vph + 'px'
});
}
body,
html {
width: 100%;
height: 100%;
margin: 0;
}
h1 {
color: white;
}
#mainPic {
width: 100%;
top: 0;
left: 0;
right: 0;
-webkit-box-shadow: inset 0px 0px 28px 0px rgba(0, 0, 0, 0.53);
-moz-box-shadow: inset 0px 0px 28px 0px rgba(0, 0, 0, 0.53);
box-shadow: inset 0px 0px 28px 0px rgba(0, 0, 0, 0.53);
background: url(//upload.wikimedia.org/wikipedia/commons/0/0e/Tree_example_VIS.jpg) no-repeat center center;
background-size: cover;
background-color: #4a565d;
}
#mainPic::before {
position: relative;
top: 0;
left: 0;
right: 0;
display: block;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
content: "";
}
.centerText {
position: relative;
top: 40%;
transform: translateY(-50%);
text-align: center;
width: 100%;
margin-right: auto;
margin-left: auto;
left: 0;
right: 0;
}
.centerBtn {
height: 50px;
width: 200px;
background-color: transparent;
color: #fff;
display: block;
border-radius: 25px;
border: 1px solid white;
transition: ease-in-out 0.15s;
font-family: arial;
}
.centerBtn:hover {
background-color: white;
color: rgb(14, 143, 185) !important;
cursor: pointer;
border-radius: 25px;
border: 1px solid rgb(134, 134, 134);
transition: ease-in-out 0.15s;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="mainPic" style="">
<div id="mainPicContent" style="position:absolute;top:75px;left:0;right:0;cursor:default;">
<div class="centerText">
<div style="width:850px;margin-right:auto;margin-left:auto;">
<h1 style="margin:0;margin-bottom:20px;">Header</h1>
<div style="width: 725px;height: 5px;margin-right: auto;margin-left: auto;">
<a class="centerBtn" style="float:left;margin-left:145px;" href="#">
<p>Button</p>
</a>
<a class="centerBtn" style="float:right;margin-right:145px;" href="#">
<p>Button</p>
</a>
</div>
</div>
</div>
</div>
</div>
As far as I can tell thats everything relavant to the picture - let me know if you need anything else
Edit 2: Jsfiddle
I have some image thumbnails and, on hover, I want the title to be displayed on top of a transparent black <div> overlay which covers the width and height of the thumbnail.
I'm using display: table and display: table-cell; respectively (to allow for vertical middle positioning).
However, every time I try this, the overlay <div> is acting as a small strip rather than covering the whole <div>.
I've tried adding padding and margins but am still unable to get my desired behaviour.
http://jsfiddle.net/jameshenry/t92qukz8/2/
The CSS:
.griditem {
position: relative;
background-color: #777;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
width: 50%;
overflow: hidden;
}
.titles {
position: absolute;
display: table;
left: 0px;
top: 0px;
bottom: 0px;
right: 0px;
width: 100%;
opacity:0;
-webkit-transition: opacity .5s ease;
-moz-transition: opacity .25s ease;
background: rgba(0, 0, 0, 0.5);
color: #FFFFFF;
text-decoration: none;
z-index: 999;
}
.titles p {
display: table-cell;
vertical-align: middle;
text-align: center;
text-decoration: none;
}
.griditem:hover .titles {
text-decoration: none;
opacity:1;
}
h5 {
font-family: Helvetica Neue;
font-size: 5em;
color: #FFFFFF;
padding-bottom:0;
margin-bottom:-30px;
}
h6 {
padding-top: 0;
}
}
and the HTML
<div class="griditem" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/8/80/Aspect_ratio_-_16x9.svg); background-size:100% 100%;">
<img src="http://i.imgur.com/JnW9SPx.png" width="100%" alt="Spacer 16x9" />
<a href="http://www.google.com" class="titles">
<p>BIG TEXT<br>
small Title<p>
</a>
</div>
How can I alter my css/html to get my desired behaviour?
In order to have the table take up 100% height, it needs to have a height context to reference (since no parent is set to any 'height', it collapses). Your problem can be solved by adding a wrapper to your table that sets that context, and adding height:100%; to your display:table; element.
.griditem {
position: relative;
background-color: #777;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
width: 50%;
overflow: hidden;
}
/*added overlay CSS*/
.overlay {
position: absolute;
left: 0px;
top: 0px;
bottom: 0px;
right: 0px;
width: 100%;
height: 100%;
}
.titles {
display: table;
width: 100%;
height: 100%; /*important, forces to 100% height of parent*/
opacity:0;
-webkit-transition: opacity .5s ease;
-moz-transition: opacity .25s ease;
background: rgba(0, 0, 0, 0.5);
color: #FFFFFF;
text-decoration: none;
z-index: 999;
}
.titles p {
display: table-cell;
vertical-align: middle;
text-align: center;
text-decoration: none;
}
.griditem:hover .titles {
text-decoration: none;
opacity:1;
}
h5 {
font-family: Helvetica Neue;
font-size: 5em;
color: #FFFFFF;
padding-bottom:0;
margin-bottom:-30px;
}
h6 {
padding-top: 0;
}
<div class="griditem" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/8/80/Aspect_ratio_-_16x9.svg); background-size:100% 100%;">
<img src="http://i.imgur.com/JnW9SPx.png" width="100%" alt="Spacer 16x9" />
<div class="overlay">
<a href="http://www.google.com" class="titles">
<p>BIG TEXT<br>
small Title<p>
</a>
</div>
</div>
You could easily solve this by using a bit of jquery like so. Demo can be found here.
var pheight = $(".griditem").height();
$(".titles p").css("height", pheight);
$(window).resize(function () {
var pheight = $(".griditem").height();
$(".titles p").css("height", pheight);
});