Modal opening at bottom of longer pages, not top - html

I have a relatively simple modal (i've dumbed down the content for this question) which is made of an overlay, a modal container and then the modal itself.
It works as expected except for the fact that on longer pages that need to be scrolled through, it shows at the bottom of the page. I've altered the CSS several times to no avail
How can I make it so that this modal opens at the top area of the page no matter what?
.modal-vue {
display: block;
}
.modal-vue .overlay {
text-align: center;
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
}
.modal-vue .modal {
position: relative;
width: 80%;
z-index: 9999;
margin: 0 auto;
padding: 20px 30px;
background-color: #fff;
margin-top: -20%;
}
.modal-vue .close {
position: absolute;
top: 10px;
right: 10px;
}
<div style="height:1200px;">
</div>
<div class="modal-vue">
<!-- overlay to help with readability of modal -->
<div class="overlay"></div>
<!-- Modal for detail on table cell click event -->
<div class="modal">
<button class="close">x</button>
<div class="uk-grid">
<!-- Starting real modal body for iteration now -->
<div class="uk-width-5-10" style="margin-bottom:60px;">
<div class="md-card">
<div class="md-card-toolbar">
TEST
</div>
</div>
</div>
<!--end modal-->
</div>
<!--end modal overlay-->
</div>
<!--end modal-vue-->

HTML:
<div style="height:1200px;">
</div>
<div class="overlay" >
<div class="modal-vue" >
<!-- overlay to help with readability of modal -->
<!-- Modal for detail on table cell click event -->
<div class="modal">
<button class="close" >x</button>
<div class="uk-grid">
<!-- Starting real modal body for iteration now -->
<div class="uk-width-5-10" style="margin-bottom:60px;">
<div class="md-card">
<div class="md-card-toolbar">
TEST
</div>
</div>
</div>
<!--end modal-->
</div>
<!--end modal overlay-->
</div>
<!--end modal-vue-->
</div>
CSS:
body{
margin:0;
}
.modal-vue{
display: flex;
justify-content:start;
height:100vh;
align-items:start;
}
.modal-vue .overlay {
text-align: center;
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
}
.modal-vue .modal {
position: relative;
width: 80%;
z-index: 9999;
margin: 0 auto;
padding: 20px 30px;
background-color: #fff;
margin-top:2rem;
}
.modal-vue .close{
position: absolute;
top: 10px;
right: 10px;
}
Link to jsfiddle -> http://jsfiddle.net/Markov88/u9eq2oh3/23/

Related

CSS Pseudo elements not positioned properly on Safari

I've wrote the following CSS that uses pseudo elements to design a footer.
Looks like it works fine on Chrome & Firefox on windows but on Safari the footer_il::after goes on the bottom of the page.
When im adding margin-top: -20em; on .footer_il::after it's working the way i want it but it obviously breaks on other browsers.
.footer_il::before {
width: 75px;
height: 70px;
-webkit-transform: rotate(134deg);
-ms-transform: rotate(134deg);
transform: rotate(134deg);
left: calc(100% - 463px - 85px);
margin-top: -2em;
}
.footer_il::after {
height: 54px;
left: 0;
width: calc(100% - 449px - 63px);
}
.footer_il::before,
.footer_il::after {
z-index: 100;
position: absolute;
content: "";
background-color: #f7f7f7
}
.footer {
height: 20em;
background-color: #000;
width: 100%;
display: inline-flex;
}
<!-- Footer -->
<footer class="footer_il bg-light">
<div class="footer">
<div class="footer_section_1">
<div class="footer_container">
<div class="footer_branding">
<div class ="footer_logo">
</div>
</div>
</div>
</div>
<div class="footer_section_2">
</div>
<div class="footer_section_3">
<div class="footer_container">
</div>
</div>
<div class="footer_section_4">
</div>
</div>
</footer>
So just by playing around a bit i ended up with the following result. Thanks to pschueller for the hint.
I've added the entire footer into a container. Set the class in absolute position and 100% width. Then added inside the ::after class 0 distance from top.
Now it's working on Mac OS Safari. Because there wasn't a top before it was getting outside of it's intended position.
.footer_entire_container {
position: absolute;
width: 100%;
}
.footer_il::before {
width: 75px;
height: 70px;
-webkit-transform: rotate(134deg);
-ms-transform: rotate(134deg);
transform: rotate(134deg);
left: calc(100% - 463px - 85px);
margin-top: -2em;
}
.footer_il::after {
height: 54px;
left: 0;
top: 0;
width: calc(100% - 449px - 63px);
}
.footer_il::before,
.footer_il::after {
z-index: 100;
position: absolute;
content: "";
background-color: #f7f7f7
}
.footer {
height: 20em;
background-color: #000;
width: 100%;
display: inline-flex;
}
<!-- Footer -->
<div class="footer_entire_container">
<footer class="footer_il bg-light">
<div class="footer">
<div class="footer_section_1">
<div class="footer_container">
<div class="footer_branding">
<div class ="footer_logo">
</div>
</div>
</div>
</div>
<div class="footer_section_2">
</div>
<div class="footer_section_3">
<div class="footer_container">
</div>
</div>
<div class="footer_section_4">
</div>
</div>
</footer>
</div>

how to make a fixed header widht 100%

i am using a fixed header in a bootstrap container and try to make the header a 100% width without margins and paddings. This is the structure of the html:
<div class="container-fluid">
<div class="fixed-header" data-spy="affix" data-offset-top="200">
<!-- some content inside -->
</div>
</div>
In my css:
.affix {
padding-left: 10px;
top: 0px;
width: 100%;
z-index: 9999 !important;
background-color: rgba(0, 0, 0, 0.6);
}
Image below is the result but i want the header against the left side of the screen, like the red arrow shows. How can i achieve that?
add position:fixed or position:absolute and left:0;
without this codes:
.fixed-header {
padding-left: 10px;
top: 0px;
width: 100%;
z-index: 9999 !important;
background-color: rgba(0, 0, 0, 0.6);
height:50px;
}
<div class="container-fluid">
<div class="fixed-header" data-spy="affix" data-offset-top="200">
<!-- some content inside -->
</div>
</div>
with position:absolute and left:0;
.fixed-header {
padding-left: 10px;
top: 0px;
width: 100%;
z-index: 9999 !important;
background-color: rgba(0, 0, 0, 0.6);
height:50px;
position:absolute;
left:0;
}
<div class="container-fluid">
<div class="fixed-header" data-spy="affix" data-offset-top="200">
<!-- some content inside -->
</div>
</div>
see on full page.
.fixed-header {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9999 !important;
background-color: red;
}
<div class="container-fluid">
<div class="fixed-header">
test content
</div>
</div>

HTML Replace css background-image to video

I would like to replace and change my css background-image to video, does someone know how to make it ?
Any way to change the image to uploaded video src? Without breaking the split left and right.
The images was path under css. with .side-left {background-image: url('left.jpg');} i did try to change the source left.jpg to myvideo.mp4 but it seems doesnt work.
my html
<body>
<div class="container">
<div id="splitlayout" class="splitlayout">
<div class="intro">
<header class="codropsheader clearfix">
<!--
<span>Rex Photography<span class="bp-icon bp-icon-about" data-content="Photography is the science, art, application and practice of creating durable images by recording light or other electromagnetic radiation, either electronically by means of an image sensor, or chemically ..."></span></span>
-->
<img class="headerlogo" src="logo2.jpg" title="PixPodium" alt="PixPodium"/>
<!--
<nav>
<a href="project.html" class="bp-icon bp-icon-prev" data-info="Go to Projects" ><span>Go to Commercials</span></a>
<span>Go to Weddings</span>
<!--
<span>back to the Codrops article</span>
-->
<!--
<span>Contact Us</span>
<!--
</nav>
-->
<div class="demos">
Commercials
Weddings
Contact Us
</div>
</header>
<div class="topWrapper" style ="display:none;">
<div class="side side-left" >
<div class="intro-content">
<!--
<div class="profile"><img src="img/profile1.jpg" alt="profile1"></div>
-->
<h1 ><span></span><span>Commercials</span></h1>
</div>
<div class="overlay"></div>
</div>
</div>
<div class= "bottomWrapper" style = "display:none;">
<div class="side side-right" >
<div class="intro-content">
<!-- Original Code Start
<h1 style="background-color:rgba(0, 0, 0, 0.5);"><span >Weddings</span><span>Weddings</span></h1>
Original Code End -->
<h1><span></span><span>Weddings</span></h1>
</div>
<div class="overlay"></div>
</div>
</div>
</div><!-- /intro -->
</div><!-- /splitlayout -->
</div><!-- /container -->
</body>
<script src="js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".topWrapper").fadeIn(1000);
$(".bottomWrapper").fadeIn(1000);
//$(".topWrapper").fadeIn("slow");
//$("#div3").fadeIn(3000);
});
</script>
</html>
my css
html, body,
.container {
position: relative;
width: 100%;
height: 100%;
}
body {
overflow-y: scroll;
/*
background: #fff;
*/
background: #fff;
}
.splitlayout {
position: relative;
overflow-x: hidden;
min-height: 100%;
width: 100%;
}
/* Intro sides */
.side {
position: fixed;
/*top: 0; */
z-index: 100;
width: 50%;
height: 100%;
text-align: center;
-webkit-backface-visibility: hidden;
}
.open-left .side,
.open-right .side {
cursor: default;
}
.overlay {
position: absolute;
top: 0;
left: 0;
z-index: 499;
visibility: hidden;
width: 100%;
height: 100%;
opacity: 0;
}
.side-left .overlay {
background: rgba(0,0,0,0.7);
}
.side-right .overlay {
background: rgba(0,0,0,0.3);
}
.side-left {
/* Original code Start
left: 0;
background: #47a3da;
color: #fff;
outline: 1px solid #47a3da; /* avoid gap
Original Code End */
left: 0;
float: left;
background-image: url('left.jpg');
/* <------ */
background-size: cover; /* <------ */
background-repeat: no-repeat;
background-position: center center; /* optional, center the image*/
/*background: #47a3da;*/
color: #fff;
/*outline: 1px solid #47a3da; /* avoid gap */
}
.side-right {
/* Original code Start
right: 0;
background: #fff;
color: #47a3da;
/*outline: 1px solid #fff; /* avoid gap */
right: 0;
background-image: url('right.jpg');
background-size: cover; /* <------ */
background-repeat: no-repeat;
background-position: center center; /* optional, center the image*/
color: #fff;
}
You can do it using video tag in html:
<video autoplay muted loop id="myVideo">
<source src="video.mp4" type="video/mp4">
Any alternate text.
</video>
And in css:
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}
This will help you to learn and implement the feature that you need.
Make the video a static or absolute div within the body.
Set it to width and height 100%.
Position the content over it.
See this example:
https://jsfiddle.net/zrjqctov/7/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#videobackground {
width: 100%;
height: 100%;
background-color: red;
position: fixed;
top: 0;
left: 0;
z-index: 1;
}
#videobackground iFrame {
width: 100%;
height: 100%;
}
#container {
height: 100%;
width: 100%;
font-family: sans-serif;
z-index: 2;
position: absolute;
top: 0;
left: 0;
}
#container > div {
background-color: rgba(255,255,255,0.5);
}
<div id="videobackground">
<iframe width="560" height="315" src="https://www.youtube.com/embed/Ztc6_elMg60" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div id="container">
<div>
<h1>
Content here
</h1>
</div>
<div class="demos">
Commercials
Weddings
Contact Us
</div>
</div>

Text block over image with background the same length of the image

I'm trying to create a text block with transparent background which is the same width as the image. However if I just add padding to the header then some may overlap or not be long enough due to the varying length in text.
Currently looks like this: http://puu.sh/sdBCX/994cc31da8.png
Here is the relevant HTML:
<div class="container-fluid">
<div class="row">
<div class="artist-grid">
<div class="col-lg-2"></div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>BASSNECTAR</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>DATSIK</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>CHAINSMOKERS</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>ZEDS DEAD</span></h3>
</div>
<div class="col-lg-2"></div>
</div>
</div>
</div>
And the relevant CSS:
h3 {
position: absolute;
top: 244px;
width: 100%
}
h3 span {
color: white;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
.artist-grid {
padding-top: 22px;
}
#artistTile {
position: relative;
max-width: 100%;
}
Cheers!
div {
width: 200px;
height: 200px;
display: block;
position: relative;
}
div::after {
content: "";
background: url(image.jpg);
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}

an icon who goes out the screen when i resize the browser

i have problem witn an icon (Loop icon) who goes out the screen when i resize the browser and that's create a white margin left , i'm using bootstrap and less , i i putted a Link to the page for you to see my problem and this is the code too
HTML
<body>
<header class="top-header">
<div class="container">
<div class="row">
<div class="span6">
<h1 class="logo">
Caspevi
</h1>
<h2>Le Moteur de recherche</h2>
</div>
<div class="span6"></div>
</div>
</div>
<!-- end container -->
</header>
<!-- Recherche générale -->
<section>
<div class="section-form1">
<div class="container">
<form action"/" method="post" class="genaral-form">
<p class="contour">
</p>
</form>
</div>
</div>
</section>
<!-- recherche personaliser -->
</body>
CSS
.section-form1 {
background: url('../image/background_top.png') no-repeat center;
background-color: #000;
width: 100%;
height: 694px;
a {
background: url('../image/forme_serche.png');
width: 61px;
height: 61px;
position: absolute;
top: -40px;
left: 413px;
&:hover {
background: url('../image/forme_serche_hover.png');
}
}
}
.contour {
position: relative;
height: 239px;
border: 1px solid white;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-left: 120px;
margin-right: 120px;
margin-top: 80px;
}
I advise that you need to change the position from absolute to relative. You can then use a float:left and a width-margin that is a percentage.
You have just to replace this line. The absolute position have to be from right :
.section-form1 a {
...
left: 413px;
}
by
.section-form1 a {
...
right: -27px;
}
Regards
Like the above answer, it is just problem with position: absolute. I would recommend you to not use position: "absolute" or "fixed" just in special cases. You will have a lot of problems with responsive/fluid designs.