Input control floating placeholder stays on validation - html

I am trying to achieve a floating placeholder functionality. Everything works fine with the code I have written except for the fact that when there is an email field and I try to add a wrong entry which is not of an email format and i shift focus from the input box, the floating text still appears. You can check the codepen link
Belew is my code:-
.-input-container {
max-width: 540px;
padding-bottom: 30px;
margin-top: 30px;
}
input.-textbox {
width: 100%;
border-radius: 40px;
background-color: #f5f5f5;
border: 1px solid #dddddd;
padding: 16px 30px;
font-size: 16px;
color: #555555;
font-family: OpenSans;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.88;
letter-spacing: normal;
text-align: left;
}
input.-textbox:focus{
outline: none;
box-shadow: none
}
input.-textbox:focus ~ .floating-label,
input.-textbox:not(:focus):valid ~ .floating-label {
top: 8px;
bottom: 10px;
left: 45px;
font-size: 10px;
opacity: 1;
line-height: 2.1;
font-family: OpenSans;
}
input.-textbox ~ .floating-label {
position: absolute;
pointer-events: none;
left: 45px;
top: 18px;
transition: 0.2s ease all;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/css/bootstrap.css" rel="stylesheet"/>
<div class="-input-container col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 ">
<input type="email" class="-textbox form-control" required="">
<span class="floating-label">E-postadress</span>
</div>

Try this:
.-input-container {
max-width: 540px;
padding-bottom: 30px;
margin-top: 30px;
}
input.-textbox {
width: 100%;
border-radius: 40px;
background-color: #f5f5f5;
border: 1px solid #dddddd;
padding: 16px 30px;
font-size: 16px;
color: #555555;
font-family: OpenSans;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.88;
letter-spacing: normal;
text-align: left;
&:focus{
outline: none;
box-shadow: none
}
}
<div class="-input-container col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 ">
<input type="email" class="-textbox form-control" placeholder="E-postadress" required="">
</div>

Use javascript in it. Try this
$('input').on('focusin', function() {
$(this).parent().find('span').addClass('test2');
});
$('input').on('focusout', function() {
if (!this.value) {
$(this).parent().find('span').removeClass('test2');
}
});
.-input-container {
max-width: 540px;
padding-bottom: 30px;
margin-top: 30px;
}
input.-textbox {
width: 100%;
border-radius: 40px;
background-color: #f5f5f5;
border: 1px solid #dddddd;
padding: 16px 30px;
font-size: 16px;
color: #555555;
font-family: OpenSans;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.88;
letter-spacing: normal;
text-align: left;
}
input.-textbox:focus {
outline: none;
box-shadow: none
}
input.-textbox:focus~.floating-label,
input.-textbox:not(:focus):valid~.floating-label, {
top: 18px;
bottom: 10px;
left: 45px;
font-size: 10px;
opacity: 1;
line-height: 2.1;
font-family: OpenSans;
}
input.-textbox~.floating-label {
position: absolute;
pointer-events: none;
left: 45px;
top: 18px;
transition: 0.2s ease all;
}
.test2{
margin-top:-20px;
line-height:2.1;
font-size:10px;
font-family: OpenSans;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/css/bootstrap.css" rel="stylesheet" />
<div class="-input-container col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 ">
<input type="email" class="-textbox form-control" required="" id=spa>
<span class="floating-label">E-postadress</span>
</div>

It is simple with some Javascript and minor changes in styles. Try this one.
$(document).ready(function () {
$('.-textbox').click(function (){
$(this).siblings('span').addClass('active');
});
$('.-textbox').blur(function(){
if($('.-textbox').val()=== ''){
$(this).siblings('span').removeClass('active');
}
});
});
.-input-container {
max-width: 540px;
padding-bottom: 30px;
margin-top: 30px;
position: relative;
}
input.-textbox {
width: 100%;
border-radius: 40px;
background-color: #f5f5f5;
border: 1px solid #dddddd;
padding: 16px 30px;
font-size: 16px;
color: #555555;
font-family: OpenSans;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.88;
letter-spacing: normal;
text-align: left;
&:focus{
outline: none;
box-shadow: none
}
}
input.-textbox ~ .floating-label {
position: absolute;
pointer-events: none;
left: 45px;
top: 18px;
transition: 0.2s ease all;
}
input.-textbox ~ .floating-label.active{
top: 8px;
bottom: 10px;
left: 45px;
font-size: 10px;
opacity: 1;
line-height: 2.1;
font-family: OpenSans;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="-input-container col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 ">
<input type="email" class="-textbox form-control" required="">
<span class="floating-label">E-postadress</span>
</div>

Related

position: fixed; diesn't work for the form element

I am struggling to make the form on the page fixated to it's current position and doesn't want it to move while scrolling the page. it should be there always at it's current position. the css styling for the form {position: fixed} doesn't work. it makes the whole form disappear from the page. Tried different techniques but none did worked.
even tried giving the form element a {z-index: 1000} but that also didn't helped.
any help would be appreciated.
.rafting-and-camping{
padding-left: 130px;
height: 47px;
width: 724px;
color: #3C4858;
font-family: Roboto;
font-size: 40px;
font-weight: bold;
line-height: 47px;
}
.ganga-river-camp-by {
padding-left: 130px;
height: 48px;
width: 500px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
line-height: 24px;
}
.stories {
padding-left: 190px;
height: 16px;
width: 63px;
color: #3C4858;
font-family: Roboto;
font-size: 14px;
line-height: 16px;
display: inline;
}
.hours {
padding-left: 78px;
height: 16px;
width: 49px;
color: #8492A6;
font-family: Roboto;
font-size: 14px;
line-height: 16px;
display: inline;
}
.viewed-135-times-tod {
padding-left: 78px;
height: 19px;
width: 171px;
color: #8492A6;
font-family: Roboto;
font-size: 16px;
line-height: 19px;
display: inline;
}
.starts-from-1600 {
padding-left: 420px;
height: 42px;
width: 174px;
color: #3C4858;
font-family: "PingFang SC";
font-size: 16px;
line-height: 22px;
display: inline
}
.mask {
margin-top: 2%;
padding-left: 130px;
height: 500.62px;
width: 1020px;
}
.rectangle-2 {
margin-left: 10%;
height: 90px;
width: 250px;
border: 1px solid #C0CCDA;
display: inline-block;
}
.rectangle-3 {
height: 90px;
width: 250px;
border: 1px solid #C0CCDA;
display: inline-block;
}
.scuba-price {
height: 0.51%;
width: 4.53%;
color: #3C4858;
font-family: "PingFang SC";
font-size: 20px;
font-weight: 500;
line-height: 28px;
}
.bali-scuba-divers {
height: 19px;
width: 123px;
color: #3C4858;
font-family: Roboto;
font-size: 16px;
line-height: 19px;
}
.line-2 {
margin-left: 130px;
box-sizing: border-box;
height: 0.04%;
width: 47.34%;
border: 1px solid #E5E9F2;
}
.what-to-expect {
padding-left: 130px;
padding-top: 20px;
height: 24px;
width: 134px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.let-s-sail-in-a-rega {
padding-left: 130px;
height: 125px;
width: 600px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 25px;
}
.what-s-included {
padding-left: 130px;
height: 24px;
width: 141px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.tea-a-vegetarian-l {
padding-left: 130px;
height: 0.44%;
width: 24.77%;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 24px;
}
.materials-and-tools {
padding-left: 130px;
height: 71px;
width: 606.29px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 25px;
}
.pre-requisites {
padding-left: 130px;
height: 24px;
width: 124px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.all-participants-sho {
padding-left: 130px;
height: 23px;
width: 606.29px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 23px;
}
.where-we-ll-meet {
padding-left: 130px;
height: 24px;
width: 153px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.being-born-in-the-wr {
padding-left: 130px;
height: 161px;
width: 606.29px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 23px;
}
.rectangle-4 {
padding-left: 130px;
height: 6.14%;
width: 47.34%;
}
.contact-operator {
padding-left: 130px;
height: 24px;
width: 154px;
color: #1FB6FF;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.cancellation-and-res {
padding-left: 130px;
height: 0.44%;
width: 25.7%;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.any-trip-or-experien {
padding-left: 130px;
height: 48px;
width: 606.29px;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 24px;
}
.notes {
padding-left: 130px;
height: 0.44%;
width: 4.22%;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 500;
line-height: 24px;
}
.we-ll-recommend-you {
padding-left: 130px;
height: 1.32%;
width: 47.37%;
color: #3C4858;
font-family: Roboto;
font-size: 20px;
font-weight: 300;
line-height: 24px;
text-align: justify;
}
/*form style*/
.form {
max-width: 400px;
width: 100%;
margin-top: -95%;
margin-left: 60%;
position: relative;
overflow-y: auto;
}
#contact {
background: #F9F9F9;
padding: 25px;
margin: 150px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
#contact h3 {
display: block;
font-size: 30px;
font-weight: 300;
margin-bottom: 10px;
}
fieldset {
border: medium none !important;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
}
#contact input[type="date"]{
width: 93%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#contact select {
width: 100%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#contact input[type="date"]:hover,
#contact select {
-webkit-transition: border-color 0.3s ease-in-out;
-moz-transition: border-color 0.3s ease-in-out;
transition: border-color 0.3s ease-in-out;
border: 1px solid #aaa;
}
#contact button[type="submit"] {
cursor: pointer;
width: 100%;
border: none;
background: #4CAF50;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
}
#contact button[type="submit"]:hover {
background: #43A047;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.rectangle-7 {
height: 57px;
width: 350px;
background-color: #273444;
}
.price {
height: 42px;
width: 87px;
color: #FFFFFF;
font-family: "PingFang SC";
font-size: 30px;
font-weight: 500;
line-height: 42px;
}
/* form end*/
<!DOCTYPE html>
<html lang="en">
<head>
<title>TripShire</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="home.css">
</head>
</script>
<body>
<p class="rafting-and-camping">Rafting and camping by the Ganges</p>
<p class="ganga-river-camp-by"><b>Ganga River .</b> Camp by the river side and raft through the ice cold ganges</p>
<p class="stories">73 Stories</p>
<p class="hours">6 hours</p>
<p class="viewed-135-times-tod">Viewed 135 times today</p>
<p class="starts-from-1600">Starts from ₹1600</p>
<img class="mask" src="rafting.jpg">
<div class="rectangle-2">
<p class="scuba-price">₹1200</p>
<p class="bali-scuba-divers">Bali Scuba Drivers</p>
</div>
<div class="rectangle-3">
<p class="scuba-price">₹2500</p>
<p class="bali-scuba-divers">White Water Tours</p>
</div>
<div class="rectangle-3">
<p class="scuba-price">₹1500</p>
<p class="bali-scuba-divers">Bali Scuba Drivers</p>
</div>
<div class="rectangle-3">
<p class="scuba-price">₹3200</p>
<p class="bali-scuba-divers">Bali Scuba Drivers</p>
</div>
<hr class="line-2">
<h2 class="what-to-expect"><b>What to expect</b></h2>
<p class="let-s-sail-in-a-rega">Let's sail in a regatta sailboat built for a regatta in France and </br> remodeled. The idea is we enjoy Barcelona in a different and </br> adventurous way. We'll experiment the feeling of sailing in a boat that </br> can get high speed. The experience includes a selection of </br> "embutidos"(kind of Catalan meat) specially selected.</p>
<hr class="line-2">
<h2 class="what-s-included"><b>What's included</b></h2>
<h3 class="tea-a-vegetarian-l">Tea and a vegetarian lunch</h3>
<p class="materials-and-tools">Materials and tools </br> Everything will be provided. All animals are ethically sourced and were not killed specially for these workshops</p>
<hr class="line-2">
<h3 class="pre-requisites"><b>Pre requisites</b></h3>
<p class="all-participants-sho">All participants should be greater than 12 years of age</p>
<hr class="line-2">
<h2 class="where-we-ll-meet"><b>Where we'll meet</b></h2>
<p class="being-born-in-the-wr">Being born in the wrong country has always taken a toll on Lauren </br> and Max. With the urge of reliving the golden years, they have been </br> hosting 18th century parties around the world to fill the void. In the </br> real world, Lauren is a fashion stylist and Max works in a video </br> production. </br>
</br>
Address: Terrace Restaurant, Okura Macau, 28F
</p>
<img class="rectangle-4" src="rafting.jpg">
<p class="contact-operator">Contact Operator</p>
<hr class="line-2">
<h2 class="cancellation-and-res"><b>Cancellation and rescheduling policy</b></h2>
<p class="any-trip-or-experien">Any trip or experience can be canceled and fully refunded within 24 </br> hours of purchase.</p>
<hr class="line-2">
<h2 class="notes"><b>Notes</b></h2>
<p class="we-ll-recommend-you">We recommend ypu to get a jumper or something to keep you warm </br> (even in summer). This is a weather-dependent experience. This Experience is subject to sailing and weather conditions.</p>
<!-- Form -->
<div class="container form">
<form id="contact" action="" method="post" >
<h3 class="rectangle-7">₹2500 per person</h3>
<fieldset>
<p>Choose your date</p>
<input type="date" tabindex="1" required autofocus>
</fieldset>
<fieldset>
<p>Guests</p>
<select id="guests" name="guests">
<option value="australia">5 guest</option>
<option value="canada">4 guest</option>
<option value="usa">3 guest</option>
<option value="usa">2 guest</option>
<option value="usa">1 guest</option>
</select>
</fieldset>
<fieldset>
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
</div>
<!-- form end -->
<script>
window.onscroll = function() {myFunction()};
function myFunction() {
document.getElementById("contact").style.postion = "fixed ";
}
</body>
</html>
Did you set any styles for the position after setting position:fixed?
eg.
#contact {
/* This will position the form in the top, right */
position: fixed;
top: 0;
right: 0;
/*===============================================*/
background: #F9F9F9;
padding: 25px;
margin: 150px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
You have set too much margin to .form that it flows out of window
.form {
max-width: 400px;
width: 100%;
/* removed this
margin-top: -95%;
margin-left: 60%;
*/
position: fixed;
top: 0;
left: 0;
overflow-y: auto;
}
form {
margin: 0;
}

Fix Font Responsiveness

When you hover over the image, you will see that it will be replaced by the text block.
When you shrink the browser, you will see that the font size remains the same, although I specified it in EMs which should have made the font responsive.
I need the layout of the hover element remain the same in mobile view, i.e. I need to avoid the scrollbar that appears if you shrink the size of the browser. Any ideas how to achieve this?
/*Programs*/
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
div.text-content {
background: rgba(26,33,43,0.9);
color: white;
cursor: pointer;
left: 0;
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
opacity: 0;
font-size: 1.250em;
font-family: Roboto;
line-height: 1em;
font-weight: 300;
text-align: center;
overflow-y: auto;
box-sizing: border-box;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
padding-bottom: 25px;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
text-align: center;
vertical-align: middle;
}
ul.img-list li:hover div.text-content {
opacity: 1;
}
/* Events page */
/*Event link button*/
.btn {
background-color: transparent;
border-radius: 42px;
border: 2px solid #ffffff;
display: inline-block;
cursor: pointer;
font-family: Roboto;
line-height: 1.750em;
font-size: 1.500em;
padding: 5px 15px 5px 15px;
margin-right: 45px;
margin-left: 45px;
}
.btn:link {
color: #ffffff;
text-decoration: none;
}
.btn:visited {
color: #1b1c16;
text-decoration: none;
}
.btn:hover {
background-color: #ffffff;
color: #1b1c16 !important;
}
.btn:active {
position: relative;
top: 1px;
}
/*All events button*/
.evens_btn {
background: ;
}
.events_btn>span{
color: #f9c70f;
font-family: Roboto;
color: #ffffff;
font-size: 1.5em !important;
background: ;
text-decoration: none !important;
padding: 10px 0px 10px 0px;
}
.events_btn>i{
color: #ffffff;
margin-right: 15px;
font-size: 3.125em;
}
.events_btn:link>i {
color: #f9c70f;
}
.events_btn:visited>i {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>i {
color: #f9c70f;
}
.events_btn:active>i {
color: #f9c70f;
}
.events_btn:link>span {
color: #f9c70f;
}
.events_btn:visited>span {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>span {
color: #f9c70f ;
}
.events_btn:active>span {
color: #f9c70f;
}
<ul class="img-list">
<li><img style="width: 100%; height: 100%;" src="http://www.sflsupport.org/wp-content/uploads/2016/06/Programs-11.jpg" />
<div class="text-content">
<div>
<h5 style="color: white; font-size: 2.375em; font-family: Montserrat; font-weight: 600; line-height: 1em; letter-spacing: 0.125em;">WEBINAR<br/>ARCHIVE</h5>
<hr style="border-top: 0.125em solid #ffffff; width: auto; margin: 0.625em 1.875em;"/>Throughout the years SFL has ammased the library of recorded webinars from some of the leading libertarian voices about numerous topics in philosophy, politics, and economics. How can the government fix the higher education bubble? What is Ayn Rand's theory of natural rights? Tune in to our videos for answers to these questions and many more.
<br>
<a class="btn" style="color: white; text-align: center; margin-top: 0.625em; padding-top: 0.313em; padding-bottom: 0.313em; padding-left: 1.875em; padding-right: 1.875em; text-decoration: none; font-size: 1.500em; font-weight: 600; border: 3px solid white; letter-spacing: 0.125em;" href="http://www.google.com/" target="_blank">READ MORE</a>
</div>
</div>
</li>
</ul>
You can simply set the font size in vw instead of em
/*Programs*/
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
div.text-content {
background: rgba(26,33,43,0.9);
color: white;
cursor: pointer;
left: 0;
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
opacity: 0;
font-size: 3vw;
font-family: Roboto;
line-height: 1em;
font-weight: 300;
text-align: center;
overflow-y: auto;
box-sizing: border-box;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
padding-bottom: 25px;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
text-align: center;
vertical-align: middle;
}
ul.img-list li:hover div.text-content {
opacity: 1;
}
/* Events page */
/*Event link button*/
.btn {
background-color: transparent;
border-radius: 42px;
border: 2px solid #ffffff;
display: inline-block;
cursor: pointer;
font-family: Roboto;
line-height: 1.750em;
font-size: 1.500em;
padding: 5px 15px 5px 15px;
margin-right: 45px;
margin-left: 45px;
}
.btn:link {
color: #ffffff;
text-decoration: none;
}
.btn:visited {
color: #1b1c16;
text-decoration: none;
}
.btn:hover {
background-color: #ffffff;
color: #1b1c16 !important;
}
.btn:active {
position: relative;
top: 1px;
}
/*All events button*/
.evens_btn {
background: ;
}
.events_btn>span{
color: #f9c70f;
font-family: Roboto;
color: #ffffff;
font-size: 1.5em !important;
background: ;
text-decoration: none !important;
padding: 10px 0px 10px 0px;
}
.events_btn>i{
color: #ffffff;
margin-right: 15px;
font-size: 3.125em;
}
.events_btn:link>i {
color: #f9c70f;
}
.events_btn:visited>i {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>i {
color: #f9c70f;
}
.events_btn:active>i {
color: #f9c70f;
}
.events_btn:link>span {
color: #f9c70f;
}
.events_btn:visited>span {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>span {
color: #f9c70f ;
}
.events_btn:active>span {
color: #f9c70f;
}
<ul class="img-list">
<li><img style="width: 100%; height: 100%;" src="http://www.sflsupport.org/wp-content/uploads/2016/06/Programs-11.jpg" />
<div class="text-content">
<div>
<h5 style="color: white; font-size: 2.375em; font-family: Montserrat; font-weight: 600; line-height: 1em; letter-spacing: 0.125em;">WEBINAR<br/>ARCHIVE</h5>
<hr style="border-top: 0.125em solid #ffffff; width: auto; margin: 0.625em 1.875em;"/>Throughout the years SFL has ammased the library of recorded webinars from some of the leading libertarian voices about numerous topics in philosophy, politics, and economics. How can the government fix the higher education bubble? What is Ayn Rand's theory of natural rights? Tune in to our videos for answers to these questions and many more.
<br>
<a class="btn" style="color: white; text-align: center; margin-top: 0.625em; padding-top: 0.313em; padding-bottom: 0.313em; padding-left: 1.875em; padding-right: 1.875em; text-decoration: none; font-size: 1.500em; font-weight: 600; border: 3px solid white; letter-spacing: 0.125em;" href="http://www.google.com/" target="_blank">READ MORE</a>
</div>
</div>
</li>
</ul>

Adjust background size on hover

When you hover over the image, you will see that it will be replaced by the semi-transparent background in my code.
The transparent background is supposed to cover all the picture, however, it only covers the area taken by the text.
How do I make sure that it covers the whole picture, regardless of the text within the box?
/*Programs*/
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
div.text-content {
background: rgba(26,33,43,0.9);
color: white;
cursor: pointer;
display: table;
left: 0;
position: absolute;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
font-size: 20px;
font-family: Roboto;
line-height: 24px;
font-weight: 200;
text-align: center;
overflow-y: auto;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
padding-bottom: 25px;
box-sizing: border-box;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
overflow-y: auto;
}
div.text-content div {
display: block;
text-align: center;
vertical-align: middle;
}
ul.img-list li:hover div.text-content {
opacity: 1;
}
/* Events page */
/*Event link button*/
.btn {
background-color: transparent;
border-radius: 42px;
border: 2px solid #ffffff;
display: inline-block;
cursor: pointer;
font-family: Roboto;
line-height: 28px;
font-size: 24px;
padding: 5px 15px 5px 15px;
margin-right: 45px;
margin-left: 45px;
}
.btn:link {
color: #ffffff;
text-decoration: none;
}
.btn:visited {
color: #1b1c16;
text-decoration: none;
}
.btn:hover {
background-color: #ffffff;
color: #1b1c16 !important;
}
.btn:active {
position: relative;
top: 1px;
}
/*All events button*/
.evens_btn {
background: ;
}
.events_btn>span{
color: #f9c70f;
font-family: Roboto;
color: #ffffff;
font-size: 24px !important;
background: ;
text-decoration: none !important;
padding: 10px 0px 10px 0px;
}
.events_btn>i{
color: #ffffff;
margin-right: 15px;
font-size: 50px;
}
.events_btn:link>i {
color: #f9c70f;
}
.events_btn:visited>i {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>i {
color: #f9c70f;
}
.events_btn:active>i {
color: #f9c70f;
}
.events_btn:link>span {
color: #f9c70f;
}
.events_btn:visited>span {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>span {
color: #f9c70f ;
}
.events_btn:active>span {
color: #f9c70f;
}
<ul class="img-list">
<li><img style="width: 100%; height: 100%;" src="http://www.sflsupport.org/wp-content/uploads/2016/06/Programs-11.jpg" />
<div class="text-content">
<div>
<h5 style="color: white; font-size: 38px; font-family: Montserrat; font-weight: 600; line-height: 42px; letter-spacing: 2px;">WEBINAR<br/>ARCHIVE</h5>
<hr style="border-top: 2px solid #ffffff; width: auto; margin: 10px 30px;"/>Throughout the years SFL has ammased the library of recorded webinars from some of the leading libertarian voices about numerous topics in philosophy, politics, and economics. How can the government fix the higher education bubble? What is Ayn Rand's theory of natural rights? Tune in to our videos for answers to these questions and many more.
<br>
<a class="btn" style="color: white; text-align: center; margin-top: 10px; padding-top: 5px; padding-bottom: 5px; padding-left: 30px; padding-right: 30px; text-decoration: none; font-size: 24px; font-weight: 600; border: 3px solid white; letter-spacing: 2px;" href="http://www.google.com/" target="_blank">READ MORE</a>
</div>
</div>
</li>
</ul>
Remove display:table; from .text-content. Also add bottom:0; to it.
Remove display: table;, and for aligning the content vertically center use CSS Flexbox's align-content property.
Have a look at the snippet below:
/*Programs*/
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
div.text-content {
background: rgba(26,33,43,0.9);
color: white;
cursor: pointer;
display: flex;
align-items: center;
left: 0;
position: absolute;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
font-size: 20px;
font-family: Roboto;
line-height: 24px;
font-weight: 200;
text-align: center;
overflow-y: auto;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
padding-bottom: 25px;
box-sizing: border-box;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
overflow-y: auto;
}
div.text-content div {
display: block;
text-align: center;
vertical-align: middle;
}
ul.img-list li:hover div.text-content {
opacity: 1;
}
/* Events page */
/*Event link button*/
.btn {
background-color: transparent;
border-radius: 42px;
border: 2px solid #ffffff;
display: inline-block;
cursor: pointer;
font-family: Roboto;
line-height: 28px;
font-size: 24px;
padding: 5px 15px 5px 15px;
margin-right: 45px;
margin-left: 45px;
}
.btn:link {
color: #ffffff;
text-decoration: none;
}
.btn:visited {
color: #1b1c16;
text-decoration: none;
}
.btn:hover {
background-color: #ffffff;
color: #1b1c16 !important;
}
.btn:active {
position: relative;
top: 1px;
}
/*All events button*/
.evens_btn {
background: ;
}
.events_btn>span{
color: #f9c70f;
font-family: Roboto;
color: #ffffff;
font-size: 24px !important;
background: ;
text-decoration: none !important;
padding: 10px 0px 10px 0px;
}
.events_btn>i{
color: #ffffff;
margin-right: 15px;
font-size: 50px;
}
.events_btn:link>i {
color: #f9c70f;
}
.events_btn:visited>i {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>i {
color: #f9c70f;
}
.events_btn:active>i {
color: #f9c70f;
}
.events_btn:link>span {
color: #f9c70f;
}
.events_btn:visited>span {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>span {
color: #f9c70f ;
}
.events_btn:active>span {
color: #f9c70f;
}
<ul class="img-list"><li><img style="width: 100%; height: 100%;" src="http://www.sflsupport.org/wp-content/uploads/2016/06/Programs-11.jpg" /><div class="text-content"><div><h5 style="color: white; font-size: 38px; font-family: Montserrat; font-weight: 600; line-height: 42px; letter-spacing: 2px;">WEBINAR<br/>ARCHIVE</h5><hr style="border-top: 2px solid #ffffff; width: auto; margin: 10px 30px;"/>Throughout the years SFL has ammased the library of recorded webinars from some of the leading libertarian voices about numerous topics in philosophy, politics, and economics. How can the government fix the higher education bubble? What is Ayn Rand's theory of natural rights? Tune in to our videos for answers to these questions and many more.<br><a class="btn" style="color: white; text-align: center; margin-top: 10px; padding-top: 5px; padding-bottom: 5px; padding-left: 30px; padding-right: 30px; text-decoration: none; font-size: 24px; font-weight: 600; border: 3px solid white; letter-spacing: 2px;" href="http://www.google.com/" target="_blank">READ MORE</a></div></div></li></ul>
Hope this helps!
/*Programs*/
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
div.text-content {
background: rgba(26,33,43,0.9);
color: white;
cursor: pointer;
left: 0;
position: absolute;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
font-size: 20px;
font-family: Roboto;
line-height: 24px;
font-weight: 200;
text-align: center;
overflow-y: auto;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
padding-bottom: 25px;
box-sizing: border-box;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
overflow-y: auto;
}
div.text-content div {
display: table-cell;
text-align: center;
vertical-align: middle;
width: 100%;
height: 100%;
}
ul.img-list li:hover div.text-content {
opacity: 1;
}
/* Events page */
/*Event link button*/
.btn {
background-color: transparent;
border-radius: 42px;
border: 2px solid #ffffff;
display: inline-block;
cursor: pointer;
font-family: Roboto;
line-height: 28px;
font-size: 24px;
padding: 5px 15px 5px 15px;
margin-right: 45px;
margin-left: 45px;
}
.btn:link {
color: #ffffff;
text-decoration: none;
}
.btn:visited {
color: #1b1c16;
text-decoration: none;
}
.btn:hover {
background-color: #ffffff;
color: #1b1c16 !important;
}
.btn:active {
position: relative;
top: 1px;
}
/*All events button*/
.evens_btn {
background: ;
}
.events_btn>span{
color: #f9c70f;
font-family: Roboto;
color: #ffffff;
font-size: 24px !important;
background: ;
text-decoration: none !important;
padding: 10px 0px 10px 0px;
}
.events_btn>i{
color: #ffffff;
margin-right: 15px;
font-size: 50px;
}
.events_btn:link>i {
color: #f9c70f;
}
.events_btn:visited>i {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>i {
color: #f9c70f;
}
.events_btn:active>i {
color: #f9c70f;
}
.events_btn:link>span {
color: #f9c70f;
}
.events_btn:visited>span {
color: #ffffff;
text-decoration: none;
}
.events_btn:hover>span {
color: #f9c70f ;
}
.events_btn:active>span {
color: #f9c70f;
}
<ul class="img-list"><li><img style="width: 100%; height: 100%;" src="http://www.sflsupport.org/wp-content/uploads/2016/06/Programs-11.jpg" /><div class="text-content"><div><h5 style="color: white; font-size: 38px; font-family: Montserrat; font-weight: 600; line-height: 42px; letter-spacing: 2px;">WEBINAR<br/>ARCHIVE</h5><hr style="border-top: 2px solid #ffffff; width: auto; margin: 10px 30px;"/>Throughout the years SFL has ammased the library of recorded webinars from some of the leading libertarian voices about numerous topics in philosophy, politics, and economics. How can the government fix the higher education bubble? What is Ayn Rand's theory of natural rights? Tune in to our videos for answers to these questions and many more.<br><a class="btn" style="color: white; text-align: center; margin-top: 10px; padding-top: 5px; padding-bottom: 5px; padding-left: 30px; padding-right: 30px; text-decoration: none; font-size: 24px; font-weight: 600; border: 3px solid white; letter-spacing: 2px;" href="http://www.google.com/" target="_blank">READ MORE</a></div></div></li></ul>
Just add this Css:
.text-content div{
height:1326px;
}

form input and place holder not working in firefox

The subscribe form works but the place holder text isn't visible and when you try to type you cannot see what you're typing either. Works in Chrome and Internet Explorer but not in Firefox.
I've included an image of what it looks like in chrome and in firefox
.nform .input-group .input {
margin-bottom: 15px;
height: 30px;
}
.nform .form-control {
max-width: auto;
margin: 1px;
padding: 21px;
font-weight: 300;
color: #6a6a6a;
}
.form .input-group {
margin-bottom: 15px;
}
.footer-distributed form {
display: inline-block;
}
.footer-distributed form input,
.footer-distributed form textarea {
display: block;
border-radius: 3px;
box-sizing: border-box;
background-color: #fafafa;
box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.1);
border: none;
resize: none;
font: inherit;
font-size: 14px;
font-weight: normal;
color: #969696;
width: 280px;
padding: 18px;
}
.footer-distributed::-webkit-input-placeholder {
color: #5c666b;
}
.footer-distributed::-moz-placeholder {
color: #00aaff;
opacity: 1;
}
.footer-distributed:-ms-input-placeholder {
color: #00aaff;
}
.footer-distributed form input {
height: 20px;
margin-bottom: 15px;
}
.footer-distributed form textarea {
height: 75px;
margin-bottom: 20px;
}
.footer-distributed form button {
border-radius: 3px;
background-color: #00bbff;
color: #ffffff;
border: 0;
padding: 6px 40px;
font-weight: 500;
font-size: 18px;
float: right;
letter-spacing: 1px;
height: 42px;
}
.footer-distributed form button:hover {
border-radius: 3px;
background-color: #ffffff;
color: #00bbff;
border: 1px solid #00bfff;
padding: 6px 40px;
font-weight: 500;
float: right;
letter-spacing: 1px;
height: 42px;
}
<div class="col-md-6 col-sm-6 col-xs-12">
<div class=" subscribe-foot section-wrapper">
<p class="subscribe-nowfoot">
text
<br>text
</p>
<div class="col-md-8 col-sm-8 col-xs-12 col-sm-push-2">
<form class="nform">
<div class="input-group">
<input type="email" class="form-control border-radius" placeholder="Email address">
<span class="input-group-btn">
<button class="btn btn-form border-radius " type="button">Sign up</button>
</span>
</div>
</form>
</div>
</div>
</div>

vertically center text with difference sizes

I'm trying to create a match div, which show match information. However they should all be different sizes and it does not seem like it wants to center properly. I want all these text to be centered in the middle of the div? how can this be done?
.saperator {
margin-right: 17px;
vertical-align: text-bottom;
color: #787878;
}
.result-in-month {
padding: 25px 20px;
background: #efefef;
margin-bottom: 10px;
border-radius: 4px;
border: none;
transition: all 0.45s ease-in-out 0s;
position: relative;
}
.result-in-month:hover {
background: #FFF;
box-shadow: 0px 0px 3px 1px #e5e5e5;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.result-date {
display: inline-block;
width: 12%;
margin-right: 2%;
font-size: 12px;
font-weight: 400;
text-transform: uppercase;
line-height: 40px;
}
.result-stream {
display: inline-block;
width: 12%;
text-transform: uppercase;
line-height: 40px;
text-align: right;
color: #212121;
font-size: 36px;
}
.result-stream a:hover {
text-decoration: none;
}
.result-match-team-wrapper {
display: inline-block;
width: 72%;
text-align: center;
text-transform: uppercase;
line-height: 40px;
font-weight: normal;
font-size: 18px;
}
.result-match-versus {
padding: 0px 3px;
font-weight: normal;
color: #999999;
}
.result-match-team.left {
margin-right: 2.5%;
text-align: right;
}
.result-match-team.right {
margin-left: 2.5%;
text-align: left;
}
.result-match-team {
display: inline-block;
width: 40%;
}
.result-match-separator {
margin: 0px 2.5%;
}
#nav {
margin-left:0px !important;
}
#nav li {
display: inline-block;
padding: 4px 11px;
background-color: #fff;
margin-right: 6px;
}
#nav li a {
color: #000;
text-decoration: none;
text-transform: uppercase;
font-size: 18px;
font-weight: 400;
font-family: Oswald, Impact, sans-serif !important;
}
#nav li.active {
background-color: #000;
}
#nav li.active a {
color: #fff;
}
<div class="result-in-month">
<div class="result-date">
SLUT
</div>
<div class="result-match-team-wrapper">
<span class="result-match-team left">
TEAM 3
</span>
<span class="result-match-versus">
VS
</span>
<span class="result-match-team right">
TEAM 1
</span>
</div>
<div class="result-stream">
<span class="result-match-score" >2</span><span class="result-match-separator">-</span><span class="result-match-score">1</span>
</div>
<div class="clear"></div>
</div>
You could let the inner divs behave like table cells and then vertical align them.
div {
border: 1px solid grey;
}
.match-header {
display: table;
width: 100%;
height: 300px;
}
.v-center {
vertical-align: middle;
display: table-cell;
}
.player-a {
font-size: 3em;
text-align: center;
}
.player-b {
font-size: 6em;
text-align: center;
}
.score {
font-size: 1em;
text-align: center;
}
<div class="match-header">
<div class="player-a v-center">
Ann
</div>
<div class="score v-center">
5 vs 6
</div>
<div class="player-b v-center">
Bob
</div>
</div>
I would probably change the structure of your HTML but this should see you on the right track with what you've got.
Updated fiddle
You can use absolute positioning on the children elements of your result-in-month class like so
.result-date{
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 12%;
margin-right: 2%;
font-size: 12px;
font-weight: 400;
text-transform: uppercase;
}
.result-match-team-wrapper {
position: absolute;
top: 50%;
transform: translateY(-50%);
display: inline-block;
width: 94%;
text-align: center;
text-transform: uppercase;
line-height: 40px;
font-weight: normal;
font-size: 18px;
}
.result-stream{
position: absolute;
top: 50%;
right: 5%;
transform: translateY(-50%);
display: inline-block;
width: 12%;
text-transform: uppercase;
line-height: 40px;
text-align: right;
color: #212121;
font-size: 36px;
}
Do you mean something like this ?
https://jsfiddle.net/wgrLfxg3/4/
Because you are using elements you only declared the font and size in nav but not the rest of elements
add the follow to the other elements and it will work fine. Take a look to the fiddle
font-size: 18px;
font-weight: 400;
font-family: Oswald, Impact, sans-serif !important;