moving a gif image right - html

Ive been using simple html and css to make my new webpage. its just a gradient background with a gif in front of it. the gif has been giving me a lot of grief lately because it keeps moving out of to the right and extending the scree. i just want the gif to be centered perfectedly and at a good size right not the desktop version looks ideal but the mobile version looks so small as seen below I would just like the gif to be wider and feel the screen more without extending it.
my HTML goes as following
a,
a:focus,
a:hover {
color: #fff;
}
/* Custom default button */
.btn-default,
.btn-default:hover,
.btn-default:focus {
color: #333;
text-shadow: none;
/* Prevent inheritence from `body` */
background-color: #fff;
border: 1px solid #fff;
}
/*
* Base structure
*/
html,
body {
height: 100%;
background-repeat: no-repeat;
background-attachment: fixed;
}
body {
color: #fff;
text-align: center;
text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
background: radial-gradient( circle closest-side, #d5c83d 80%, #e9e5bf, #8482e3);
}
/* Extra markup and styles for table-esque vertical and horizontal centering */
.site-wrapper {
display: table;
width: 100%;
/*height: 100%; */
min-height: 100%;
}
.site-wrapper-inner {
display: table-cell;
vertical-align: top;
}
.cover-container {
margin-right: auto;
margin-left: auto;
}
/* Padding for spacing */
.inner {
padding: 20px;
}
/*
* Header
*/
.masthead-brand {
margin-top: 10px;
margin-bottom: 10px;
}
.masthead-nav>li {
display: inline-block;
}
.masthead-nav>li+li {
margin-left: 20px;
}
.masthead-nav>li>a {
padding-right: 0;
padding-left: 0;
font-size: 30px;
font-weight: bold;
color: #fff;
/* IE8 proofing */
color: rgba(255, 255, 255, .75);
border-bottom: 2px solid transparent;
}
.masthead-nav>li>a:hover,
.masthead-nav>li>a:focus {
background-color: transparent;
border-bottom-color: #a9a9a9;
border-bottom-color: rgba(255, 255, 255, .25);
}
.masthead-nav>.active>a,
.masthead-nav>.active>a:hover,
.masthead-nav>.active>a:focus {
color: #fff;
border-bottom-color: #fff;
}
#media (min-width: 768px) {
.masthead-brand {
float: left;
}
.masthead-nav {
float: right;
}
.jumbotron {
padding-top: calc(var(--jumbotron-padding-y) * 2);
padding-bottom: calc(var(--jumbotron-padding-y) * 2);
}
}
/*
* Cover
*/
.cover {
padding: 0 20px;
}
.cover .btn-lg {
padding: 10px 20px;
font-weight: bold;
}
/*
* Affix and center
*/
#media screen and (max-width: 992px) {}
#media (min-width: 768px) {
/* Pull out the header and footer */
.masthead {
position: fixed;
top: 0;
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
}
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="container">
<div class="masthead clearfix">
<div class="container inner">
<h3 class="masthead-brand"></h3>
<nav>
<ul class="nav masthead-nav">
<li class="active">Home*</li>
<li>Magazine#</li>
<li>Abouti</li>
</ul>
</nav>
</div>
</div>
<div class="innercover">
<img class="img" src="https://static.tumblr.com/y8b11bc/u05qfybi7/ezgif.com-resize.gif" ; style=" top: 0%; width: 100%; max-height: 100%; " ;></img>
</div>

Adjust your css code to change the size of the GIF depending if it's mobile or desktop. Also, adjust the div that holds the GIF to center the items.
#media (min-width: 768px) {
.img{
width: X%
}
.innercover{
display: flex;
justify-content: center;
align-items: center;
}

Related

Positioning issue with contact form (trying to centre)

I need help with what is the best way to fully centre the contact form in the middle of the background image no matter what view the contact form is in(desktop, tablet, mobile). I would like for there to be a smallish amount of space between the bottom and top of the contact form, however, I would like the sides of the form to be further away from the edges of the image.
I hope yous understand what I'm asking for and thanks in advance.
The contact form can be seen on the live url: http://nathan-bayne.co.uk/index1
#contact-section {
background-color: #bce4b8; /* Previous colour that Aileen liked (#A74CAB) */
border-bottom: 1px solid #000;
text-align: center;
padding: 100px 0 0;
min-height: 800px;
width: 100%;
} /* Adjusts section sizing, padding and text alignment */
.contact-section-content {
margin-left: 14%;
margin-right: 14%;
margin-top: 2%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
border: 1px solid black;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 60%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
font-size: 2em;
padding: 0.6% 6%;
border-radius: 35px;
color: #fff;
background-color: #339a9a;
border: 1px solid black;
cursor: pointer;
text-align: center;
/* clear: both; May not need this included */
margin-left: 0%;
margin-top: 1%;
} /* Styles the contact form submission button */
.contact-section-content button:hover {
color: rgb(255, 255, 255);
background-color: #004e4f;
border: 2px solid white;
} /* Styles the contact form submission button when you hover over it */
.container input::-webkit-input-placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form input placeholders */
.container textarea::placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form textarea placeholders */
#media only screen and (max-width: 1606px) {
.contact-section-content {
margin-left: 2.5%;
margin-right: 2.5%;
margin-bottom: 6%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 70%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1.5%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
padding: 1% 8%;
font-size: 1.8em;
} /* Styles the contact form submission button */
}
#media only screen and (max-width: 815px) {
.contact-section-content {
margin-left: 2.5%;
margin-right: 2.5%;
margin-top: 10%;
margin-bottom: 15%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 670px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.bg-img form {
margin-bottom: 7.5%;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 85%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1.5%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
padding: 1% 8%;
font-size: 2em;
margin-bottom: 4%;
} /* Styles the contact form submission button */
.container input::-webkit-input-placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form input placeholders */
.container textarea::placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form textarea placeholders */
}
<link rel="stylesheet" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css' media="screen" />
<section id="contact-section">
<div class="contact-section-content">
<div class="bg-img"><br><br>
<form action="/action_page.php" class="container">
<label for="psw"><b>Name</b></label>
<input type="text" placeholder="Enter Name" name="psw" required>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="number"><b>Mobile Number</b></label>
<input type="tel" name="contact_number" placeholder="Mobile Number" pattern="[0-9]{11}"/>
<label for="psw"><b>Contact Summary</b></label>
<textarea name="subject" placeholder="Write a short summary about what you're in need of help with.." required></textarea>
<button type="submit">Submit Form</button>
</form>
</div>
</div>
Just add this to.bg-img :
display: flex; align-items: center;
And set margin-top: 0 for .container
Try to add this to your .bg-image class
.bg-img {
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
display : flex ;
flex-direction : row;
align-items : center;
justify-content: center;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
border: 1px solid black;
}
what I added is display:flex and justify-content/align-items : center to center any element inside that container

How to avoid jumping html elements over each others

I'm new to CSS and web development and trying to build my own and first website. I've read a few articles related to displaying and positioning elements however I still unable to get elements positioned perfectly while resizing the browser window!.
What I am trying to accomplish is in the codepen link in the first comment below
https://codepen.io/letsimoo/pen/XWNGoGa
HTML CODE
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8">
</head>
<body class="mainBody">
<header class="mainHeader">
<div class="headerStuff">
<div class="social-list">
<div class="fb">
FB
</div>
<div class="twitter">
Twitter
</div>
<div class="instagram">
Instagram
</div>
</div>
<ul class="navigation">
<li> <b>My Projects</b> </li>
<li> <b>Gallery</b> </li>
<li> <b> About </b> </li>
<li> <b>Contact</b> </li>
</ul>
<div class="logoDiv">
<h2>Logo</h2>
</div>
</div>
<div class="HeaderLine"></div> <!-- Header Separator Line -->
</header>
</body>
CSS CODE
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.mainBody {
background-color: gray;
background-size: cover;
background-repeat: no-repeat;
color: white;
margin: 0px 0px 0px 20px;
/*width: 100%;*/
}
.mainHeader {
height: 80px;
}
.headerStuff {
height: auto;
display: flex;
position: relative;
align-items: bottom;
vertical-align: baseline;
width: 100%;
}
.social-list {
display: inline-flex;
position: absolute;
margin-top: 20px;
left: -10px;
}
.social-list div {
margin-left: 12px;
}
.navigation {
position: absolute;
right: 175px;
text-align: right;
height: 30px;
padding: 0px;
margin: 0px;
margin-top: 30px;
display: flex;
}
.navigation li {
background-color: #22385b;
display: inline-block;
margin-left: 5px;
padding: 7px 5px 7px 5px;
border-radius: 7px;
font-size: 20px;
width: 90px;
color: white;
}
.navigation li:hover {
background-color: #446291;
}
.navigation li a {
color: white;
font-size: 14px;
font-family: "Chakra Petch", sans-serif;
text-align: center;
text-decoration: none;
display: block;
}
ul li .prayer-window {
background-color: rgba(237, 239, 242, 0.9);
margin-top: 20px;
width: 400px;
height: 400px;
position: relative;
z-index: 1;
opacity: 0;
box-shadow: 0px 0px 100px black;
transition: 1s opacity, 5s width, 5s height;
}
.prayer-time:hover {
color: hotpink;
}
.prayer-time:active ~ .prayer-window {
opacity: 1;
}
.logoDiv {
position: absolute;
right: 0px;
}
.logoDiv img {
width: 150px;
}
.HeaderLine {
box-sizing: border-box;
height: 2px;
margin-top: 68px;
margin-right: 175px;
text-align: center;
background-color: pink;
box-shadow: 2px 2px 4px black, 0 0 30px red, 0 0 5px darkblue;
}
Please have a look to my code in the above link and try to resize the browser window to the minimum size
What the problem I'm facing?
Definitely you've notices how is the navigation elements jumped over the social media dev after resizing the browser window
So how can avoid this ugly act from the headerStuff div!??
Also please help me to improve my question if there are something wrong in my description or in the mentioned tags
Your .navigation .sosial-list are positioned absolute. That means they are out of the order of the other elements and does not take space by the other content.
As absolute positioned element .navigation is allways relative to the next parent element which is not positioned static. In your project it is .header-stuff. At the same time the margin-top moves it down from the top edge of header-stuff ...
So, if the screen becomes narrow your .header-stuff becomes narrow also. And your navigation keeps still in place: 175px from right edge of .header stuff and 30pxmargin from top ... that make it layered above your socials.
If you want to keep your structure enlarge the margin-top for .navigation so the navigation has still place enough to move below the social information.
But if you are open to change your sturcture you don't need an absolute positioning. Use a structure with block elements so socials and navigations are still beneath and don't layer over each other.
Just easy DEMO code structure example to explain the idea:
// css structure DEMO
nav {
display: block;
}
ul {
/* align ul to right */
margin-right: 0;
margin-left: auto;
}
li {
/* align li's into a line */
display: inline-block;
}
header hr {
... style your subheader line ...
}
// html structure DEMO
<header>
<div class="top-header>
... your socials ...
</div>
<nav>
<ul>
<li></li>
...
</ul>
</nav>
<hr>
</header>
Here's your updated updated CSS:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.mainBody {
background-color: gray;
background-size: cover;
background-repeat: no-repeat;
color: white;
/* margin: 0px 0px 0px 20px; */
}
.headerStuff {
height: 80px;
display: flex;
position: relative;
vertical-align: baseline;
width: 100%;
justify-content: space-between;
align-items: center;
}
.social-list {
display: inline-flex;
}
.social-list div {
margin-left: 12px;
}
.navigation {
margin: 0;
}
.navigation li {
background-color: #22385b;
display: inline-block;
padding: 7px 5px 7px 5px;
border-radius: 7px;
font-size: 20px;
width: 90px;
color: white;
}
.navigation li:hover {
background-color: #446291;
}
.navigation li a {
color: white;
font-size: 14px;
font-family: 'Chakra Petch', sans-serif;
text-align: center;
text-decoration: none;
display: block;
}
ul li .prayer-window {
background-color: rgba(237, 239, 242, 0.9);
margin-top: 20px;
width: 400px;
height: 400px;
position: relative;
z-index: 1;
opacity: 0;
box-shadow: 0px 0px 100px black;
transition: 1s opacity, 5s width, 5s height;
}
.prayer-time:hover {
color: hotpink;
}
.prayer-time:active ~ .prayer-window {
opacity: 1;
}
.logoDiv h2 {
margin: 0;
}
.logoDiv img {
width: 150px;
}
.HeaderLine {
box-sizing: border-box;
height: 2px;
margin: 0 auto;
text-align: center;
background-color: pink;
box-shadow: 2px 2px 4px black, 0 0 30px red, 0 0 5px darkblue;
}
You can adjust css properties for specific screen sizes via media queries.
#media only screen and (max-width: 796px) {
//
}
PS. align-items:bottom is not really a thing. Probably you meant align-items:baseline

How Do You Use Media Queria to Hide a Column from Display Grid and Adjust Your Spacing in the Column that Remains?

I'm working with CSS grids for the first time, and am kind of amazed at what they can do. I'm especially loving the fr unit. I have encountered an issue that is giving me fits however.
What I want to do is combine CSS grid and media query so that when the viewport reaches a certain size that the second column is no longer displayed. Check. That part is done. The part I can't quite figure out how to accomplish however is this:
I want the text that I have told to be center aligned to be center aligned across the row after the other column is removed. As it stands now, it holds the position it was in when the other column was present.
Also column 2 had a fixed height, but when the column is hidden with media query, the height of the remaining column is now smaller. It doesn't even stay tall enough to hold all of it's original content. I am able to partially fix that by assigning both columns the same explicit height or min-height, but strangely when I do that the vertical alignment of the column is no longer centered and moves to the top of the container.
/* - Code Requested by Commenter - */
body, html {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
line-height: 1.7;
}
h1 {font-family: "Roboto Condensed", sans-serif}
h2 {font-family: "Roboto", sans-serif}
body,h3,h4,h5,h6 {font-family: "Montserrat", sans-serif}
.pagecontainer {
position: absolute;
top: 0;
width: 100%;
height: 100%;
padding: 0;
}
.nav-container {
width: 100%
height: 70px;
z-index: 9999;
}
.navbar {
width: 100%;
height: 100%;
line-height: 72px;
z-index: 9999;
margin: auto;
top: 0;
padding: 0 16px 0 0;
overflow: hidden;
background-color: #fff!important;
box-sizing: border-box;
font-size: 17px;
}
.navbar a {
color: #777;
text-decoration: none;
}
.navbar a:hover {
background-color: #bbb;
color: #fff;
}
.nav-right {
float: right!important;
}
.navlogo {
width: auto;
height: 72px;
padding: 0;
vertical-align: middle;
}
.navbar .navbar-item {
padding: 0 16px;
float: left;
width: auto;
border: none;
display: block;
outline: 0;
}
.navbar-block .navbar-item {
width: 100%;
display: block;
text-align: left;
border: none;
white-space: normal;
float: none;
outline: 0;
}
/* common styles used throughout */
.center-text {
text-align: center;
}
.big-text {
font-size: 20px!important;
}
.huge-text {
font-size: 64px!important;
}
/* Full height header */
.header {
background-position: center;
background-size: cover;
background-image: linear-gradient(to top right, rgba(0, 0, 45, .92), rgba(45, 0, 0, 0.66)), url("../images/headerImage.jpg");
min-height: 90vh;
}
.header-display-left {
position: absolute;
top:50%;
left:0%;
padding: 50px;
transform:translate(0%,-50%);
-ms-transform:translate(-0%,-50%)
}
.header-white-text {
color: #fff;
}
.h1-header {
font-size: 36px;
line-height: 0.2;
}
.h2-header {
font-size: 28px;
}
.header-description {
max-width: 584px;
font-size: 14px;
line-height: 1.9;
}
.header-description a {
font-size: 16px;
color: #fff;
text-decoration: none;
background-color:rgba(205, 0, 0, .6);
padding: 10px 25px;
border-radius: 11px;
}
.header-description a:hover {
background-color:rgb(205, 0, 0);
padding: 10px 25px;
border-radius: 11px;
}
.header-display-bottomleft {
position:absolute;
left:0;
bottom:0;
}
.header-fa {
font-size:20px!important;
color: #888!important;
padding: 0px 0px 48px 48px;
}
.header-fa a {
font-size:20px!important;
color: #888!important;
padding: 0px 0px 48px 0;
}
.fa-hover:hover {
color: #eee;
}
.fa-hover a:hover {
color: #eee;
}
.about-container {
padding: 80px 40px;
}
/* row stylings */
.max-4-cols {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-column-gap: 28px;
padding: 0 8px;
align-items: center;
}
/* - All Code Above Requested by Commenter - */
.split-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 0px;
align-items: center;
background-color: #420000;
height: 460px;
}
.leftsplit {
color: #fff!important;
margin: auto;
align-items: center;
position: relative;
height: 100%;
}
.rightsplit {
background-size: cover;
background-position: center;
background-image: linear-gradient(to top right, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.5)), url("../images/berries.jpg");
height: 100%;
position: relative;
}
.services-text {
text-shadow: 2px 1px 2px rgba(255, 255, 0, 0.8);
font-size: 42px;
font-weight: 800;
}
/* - Requested Media Queries - */
/* Media Queries */
#media (max-width: 960px) {
.hide-mobile {
display: none!important;
}
}
#media (min-width: 960px) {
.hide-desktop {
display: none!important;
}
}
#media (max-width: 700px) {
.rightsplit {
display: none!important;
}
.split-container {
grid-template-columns: 1fr;
}
}
<div class="split-container" id="services">
<div class="column leftsplit center-text">
<h2 class="services-text">Our Services</h2>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 1</p>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 2</p>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 3</p>
</div>
<div class="column rightsplit"></div>
</div>
See What Happens When I Resize Here
At the same time you hide your right column, you should reset the grid, so the remaining column takes the whole row.
#media (max-width: 700px) {
.rightsplit {
display: none!important;
}
.split-container{
grid-template-columns: repeat(1, 1fr);
}
}
The media query was solved by resetting .split-container as #Mahatmasamatman suggested. The vertical spacing issue was fixed by assigning an explicit height to the grid container ".split-container" and then giving my left column div (.leftsplit) a height of 140px with a margin of 0 and relative positioning. I then put my .services-text to a margin of auto with a margin-bottom of -5px. Lastly, I set the margin for .services-description to auto. It was a lot of work, but I think I achieved what I was after.
.split-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 0px;
align-items: center;
background-color: #420000;
height: 460px;
text-align: center;
}
.leftsplit {
color: #fff!important;
margin: auto;
align-items: center;
position: relative;
height: 140px;
display: grid;
}
.rightsplit {
background-size: cover;
background-position: center;
background-image: url("../images/berries.jpg");
height: 100%;
}
.services-text {
font-size: 42px;
margin: auto;
margin-bottom: -5px;
}
.services-description {
margin: auto;
}
/* Media Query */
#media (max-width: 700px) {
.rightsplit {
display: none!important;
}
.split-container {
grid-template-columns: 1fr;
}
}
<div class="split-container" id="services">
<div class="column leftsplit center-text">
<h2 class="services-text">Our Services</h2>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 1</p>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 2</p>
<p class="services-description big-text"><i class="fa fa-angle-right"></i> Service 3</p>
</div>
<div class="column rightsplit"></div>
</div>

Setting viewport or optimize code

I have a problem here, than I often run into. I have this small landingpage:
Small Landingpage
When I look at the following viewports:
Iphone 6 & 6+ landscape
Ipad portrait and landscape
the form is not fitting.Is that because of bad coding, or is it just like this? Which means that there always will be some editing regarding viewports?
#import url(https://fonts.googleapis.com/css?family=Questrial);
html,
body {
height: 100%;
background: center no-repeat fixed url('../images/bg_1.jpg');
background-size: cover;
color: #444;
font-family: 'Questrial', sans-serif;
}
#media (min-width: 768px) {
h1 {
font-size: 68px;
}
}
a {
color: #999;
}
a:hover {
color: #111;
}
.catchy-text-wrapper {
width: 100%;
text-align: center;
}
#catchyText {
background-color: red;
padding: 20px;
background: rgba(32, 63, 86, 0.8);
display: inline-block;
}
#emailNews {
font-size: 20px;
}
/* Round corners on button */
.btn,
.well,
.panel {
border-radius: 0;
}
.btn-blue {
background: rgba(32, 63, 86, 1.0);
border-color: #5491bd;
border-radius: 10px;
color: #fff;
}
.btn-huge {
padding: 17px 22px;
font-size: 22px;
}
section {
padding-top: 70px;
padding-bottom: 50px;
min-height: 100%;
min-height: calc(100% - 0);
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#section1 {
background-color: rgba(0, 0, 0, 0.6);
color: #fff;
}
/* Form Config */
input {
font-size: 16px;
min-height: 40px;
border-radius: 25px;
line-height: 20px;
padding: 15px 30px 16px;
border: 1px solid #b9b9af;
margin-bottom: 10px;
background-color: #fff;
opacity: 0.9;
-webkit-transition: background-color 0.2s;
transition: background-color 0.2s;
}
.subscribe-input {
float: center;
width: 23%;
height: 5px;
text-align: left;
margin-right: 2px;
}
.btn-placing {
padding-top: 20px;
"
}
#media screen and (max-width: 767px) {
.subscribe-input {
width: 100%;
}
}
<section class="container-fluid" id="section1">
<div class="v-center">
<h1 class="text-center">COMPANY NAME</h1>
<h2 class="text-center">Change this <b>subline</b> here</h2>
<div class="catchy-text-wrapper">
<h2 class="text-center" id="catchyText">A CATCHY PIECE OF TEXT</h2>
</div>
<br>
<p class="text-center"><i id="emailNews">Enter your email for more news</i>
</p>
</div>
<div class="catchy-text-wrapper">
<form role="form" action="register.php" method="post" enctype="plain">
<input type="email" name="email" class="subscribe-input" placeholder="Enter your e-mail address..." required>
</form>
</div>
<p class="text-center btn-placing">
Give me the news
</p>
</section>
Your <input> is displaying at its default box-sizing: content-box, which means that when your
#media screen and (max-width: 767px) {
.subscribe-input {
width: 100%;
}
}
is applied, the content box is getting sized to 100%. Padding is outside the content box, so when you add in the
input {
padding: 15px 30px 16px;
}
your <input> is 60px wider than its container.
Get around this by adding box-sizing: border-box to your input's styles.

Override css of parent div

I have a full screen background video which I have added a "dimmed" div over the top of, to dim the video with a semi-transparent black fullscreen div. Code:
.dimmed:after {
content: " ";
z-index: 10;
display: block;
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .5);
}
HTML:
<div class="full_size dimmed">
<video autoplay loop poster="assets/images/home_page/polina.jpg" id="bgvid">
<!--<source src="polina.webm" type="video/webm">-->
<source src="assets/videos/polina.mp4" type="video/mp4">
</video>
<div class="not_dimmed">
{{APP_NAME}}</h5>
{{REGISTER_TEXT}}</h5>
{{LOGIN_TEXT}}</h5>
<a href="#home_page_footer" ><h5 class="nav-item clickable white-text medium-text right-text" >{{BLOG_TEXT}}</h5></a>
</div>
</div>
I want the anchor text that I have placed over the top of the video background to not be dimmed. As you can see I have added a not_dimmed class and tried to override the dimmed styles with no dimming.
However it is still dimmed. How would I "undim" the text?
All css:
.vertical-center {
height: 100%;
/*Fallback for vh unit
You might also want to use
'height' property instead.
Note that for percentage values of
'height' or 'min-height' properties,
the 'height' of the parent element
should be specified explicitly.
In this case the parent of '.vertical-center'
is the <body> element */
/* Make it a flex container */
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
/* Align the bootstrap's container vertically */
-webkit-box-align : center;
-webkit-align-items : center;
-moz-box-align : center;
-ms-flex-align : center;
align-items : center;
/* In legacy web browsers such as Firefox 9
we need to specify the width of the flex container */
width: 100%;
/* Also 'margin: 0 auto' doesn't have any effect on flex items in such web browsers
hence the bootstrap's container won't be aligned to the center anymore.
Therefore, we should use the following declarations to get it centered again */
-webkit-box-pack : center;
-moz-box-pack : center;
-ms-flex-pack : center;
-webkit-justify-content : center;
justify-content : center;
flex-wrap: wrap;
flex-direction: column;
}
/*large text on the home page*/
#motto-text {
height: calc(100% - 160px);
/*font-family: 'woodford_bourneregular', Arial, sans-serif;
font-weight: 100;*/
}
.white-text {
color: white;
}
.brand-colour-text {
color: #95F666;
}
.light-text {
font-weight: 100;
}
.medium-text {
font-weight: 300;
}
/*text on the left side of the page*/
.left-text {
margin: 60px 0px 0px 60px; float: left;
}
/*text on the right side of the page*/
.right-text {
margin: 60px 60px 0px 0px; float: right;
}
.italic-text {
font-style: italic;
}
.clickable {
cursor: pointer;
}
.with-border {
border: 1px solid #95F666;
border-radius:3px;
padding: 12px;
}
#sign-in-button {
margin-top: 48px;
}
.nav-item:hover {
color: #95F666;
}
#app-name:hover {
color: white;
}
#sign-in-button:hover{
background-color: #95F666;
color: dimgray;
}
#media only screen and (max-width: 500px) {
h3 {
font-size: 17px;
}
h4 {
font-size: 13px;
}
h1 {
font-size: 20px;
}
#app-name {
display: none;
}
right-text {
margin: 60px 30px 0px 30px;
}
}
.full_size {
height: 100%;
background-size: cover;
}
/*subtract the height of the footer to get an accurate vertical center*/
#home_page_background {
height: calc(100% - 60px);
background-repeat: no-repeat;
background-attachment: fixed;
}
#media only screen and (orientation: landscape) {
#home_page_background {
background-image: url("../assets/images/home_page/bg_ls_strawberry_dark.jpg");
}
}
#media only screen and (orientation: portrait) {
#home_page_background {
background-image: url("../assets/images/home_page/bg_p_strawberry_dark.jpg");
}
}
.dimmed:after {
content: " ";
z-index: 10;
display: block;
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .5);
}
.not_dimmed {
z-index: 11;
background: transparent;
}
video#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(../assets/images/home_page/polina.jpg) no-repeat;
background-size: cover;
}
/*for ie 9*/
video { display: block; }
#media screen and (max-device-width: 800px) {
html {
background: url(../assets/images/home_page/polina.jpg) #000 no-repeat center center fixed;
}
#bgvid {
display: none;
}
}
You could apply the background-color-dim from the :after-element to the anchors' container instead.