Media queries question: how to change div position without changing HTML, only with CSS.
I want the contact form with all the inputs and button <div class="contact__form"> which is on the right, to be above the map, when in mobile version.
link to codepen in case: https://codepen.io/RakuRak/pen/oEGaBw
#map {
width: 100%;
z-index: 0;
position: absolute;
height: 100%;
top: 0;
}
.contact {
z-index: 1;
position: relative;
height: 600px;
border-top: 3px solid #3EAC37;
}
.contact__bottomBar {
position: absolute;
left: 10px;
bottom: 10px;
height: 50px;
background: rgba(255,255,255,0.85);
width: calc((100% / 3) * 2 - 30px);
text-align: center;
line-height: 50px;
box-shadow: 0px 0px 3px rgba(0,0,0,0.2);
}
.contact__form {
background: rgba(255,255,255,0.85);
box-shadow: 0px 0px 3px rgba(0,0,0,0.2);
width: calc(100% / 3);
float: right;
height: calc(100% - 20px);
position: relative;
z-index: 1;
padding: 20px;
margin-right: 10px;
margin-top: 10px;
.button {
display: block;
background: #fff;
text-transform: uppercase;
font-size: 20px;
color: #3EAC37;
i {
color: rgba(0,0,0,0.7);
padding-top: 5px;
padding-right: 6px;
}
&:last-of-type {
margin: 0;
}
}
label {
text-align: left;
display: block;
margin-bottom: 4px;
}
.form-horizontal {
background: #f5f5f5;
box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
padding: 10px;
.form-group {
margin-bottom: 20px;
&:last-of-type {
margin-bottom: 10px;
}
}
h4 {
margin-bottom: 20px;
}
input, textarea {
border: 1px solid #bbb;
&:active, &:focus {
border-color: #3EAC37;
box-shadow: 0 0 0 0.2rem rgba(62, 172, 55,.25)
}
}
.btn {
display: block;
width: 200px;
margin: 0 auto;
}
}
textarea {
min-height: 62px;
}
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<section id="contact" class="contact">
<div id="map"></div>
<div class="contact__bottomBar">
<i class="fas fa-map-marker-alt fa-md"></i> Lorem ipsum
</div>
<div class="contact__form">
<div class="button">
<i class="fas fa-phone-square fa-lg"></i><a class="link" href="tel:00000000">00 00 00 00</a>
</div>
<div class="contact__separator"></div>
<div class="button">
<i class="fas fa-envelope-square fa-lg"></i><a class="link" href="mailto:lorem#ipsum.net.com" target="_top">lorem#ipsum.net.com</a>
</div>
<div class="contact__separator"></div>
<form action="https://formspree.io/lorem#gmail.com" method="post" class="form-horizontal">
<h4>Napisz do nas</h4>
<div class="form-group">
<label for="user-name" class="control-label">Imię</label>
<input name="name" type="text" class="form-control" id="user-name" placeholder="Wpisz swoje imię/nazwę firmy">
</div>
<div class="form-group">
<label for="user-email" class="control-label">Email</label>
<input name="email" type="email" class="form-control" id="user-email" placeholder="Wpisz swój Email">
</div>
<div class="form-group">
<label for="user-message" class="control-label">Wiadomość</label>
<textarea name="user-message" id="user-message" class="form-control"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success">Wyślij</button>
</div>
</form>
</div>
</section>
You need to use media queries.
#media screen and (max-width: 767px) {
.contact__form {
width: 100%; // Whatever you want
}
}
I changed the postition as I wanted in first place, below CSS for mobile version:
#map {
// width: 100%;
// z-index: 0;
position: relative; //absolute//
height: 100%;
top: 0;
}
.contact__bottomBar {
position: absolute;
left: 10px;
right: 10px;
bottom: 10px;
height: 50px;
background: rgba(255, 255, 255, 0.85);
width: auto;
text-align: center;
line-height: 50px;
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.2);
}
.contact {
// z-index: 1;
// position: relative;
height: 600px;
border-top: 3px solid #3EAC37;
}
.contact__form {
background: rgba(255,255,255,0.85);
box-shadow: 0px 0px 3px rgba(0,0,0,0.2);
width: 100%;
// float: right;
// height: calc(100% - 20px);
// position: relative;
// z-index: 1;
padding: 20px;
margin-right: 10px;
margin-top: 10px;
}
footer {
background: rgba(0, 0, 0, 0.7);
text-align: center;
height: 40px;
line-height: 40px;
/* bottom: 0px; */
/* margin-bottom: -13px; */
margin-top: 600px;
color: #fff;
position: relative;
}
Related
I'm have a school project that I'm working on and I'm baffled by the fact that after a dozen searches, I can't get the CSS to render on the master page. The other pages work fine without any issues, but for some reason I can't find a solution to my issue.
I've tried using
<link href="~/Content/Master.css" rel="stylesheet" type="text/css" runat="server"/>
as well as
<link href="../../Content/Master.css" rel="stylesheet" type="text/css"/>
Yet they yield no result
Master Page
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Auth.master.cs" Inherits="Task_3.User.Auth.Auth" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title><%: Page.Title %> || Course Manager</title>
<link href="~/Content/Master.css" rel="stylesheet" type="text/css" runat="server"/>
</head>
<body>
<form runat="server">
<div>
<div id="mySidenav" class="sidenav">
<span>Course Manager</span>
<div class="container">
Dashboard
Add Modules
View Modules
<a class="logout" href="#">Log Out</a>
</div>
</div>
<asp:ContentPlaceHolder ID="Content" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Master.css file
* {
margin: 0;
padding: 0;
font-family: 'Microsoft Yahei';
}
body {
background-color: #EEF2F5;
}
/* The side navigation menu */
.sidenav {
height: 100%;
width: 249px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #FFFFFF;
overflow-x: hidden;
padding-top: 20px;
}
/* The navigation menu links */
.sidenav .container a {
width: 100%;
padding: 8px 20px 8px 0px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
.sidenav span {
width: 100%;
padding: 8px 8px 8px 15px;
text-decoration: none;
font-size: 25px;
display: block;
font-family: 'Microsoft Yahei';
font-weight: bold;
}
/* When you mouse over the navigation links, change their color */
.sidenav .container a:hover {
color: #343434;
}
.main .topbar {
width: 80%;
height: 210px;
background: transparent;
margin: 25px auto;
border-radius: 5px;
}
.sidenav .container a:focus {
border-left: 5px solid #563c5c;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.sidenav .container {
width: 100%;
margin: 150px auto;
text-align: center;
}
.sidenav .container .logout {
margin: 85px auto;
}
#Content {
margin-left: 250px;
}
Login page where styling works
<asp:Content runat="server" ContentPlaceHolderID="MainContent">
<link href="../Content/Site.css" rel="stylesheet" type="text/css"/>
<div id="form">
<div class="login">
<div class="login col1">
<div class="login icon">
<asp:Image runat="server" ImageUrl="~/Img/studying.png" />
</div>
<h2>Login</h2>
<div class="login stack">
<asp:TextBox type="email" ID="txtEmail" runat="server" placeholder="Email" />
<br />
<asp:TextBox type="password" runat="server" ID="txtPassword" placeholder="Password" />
<br>
<p class="login forgot-pas">Forgot Password?</p>
<asp:Button ID="btnLogin" CssClass="button" Text="Login" OnClick="btnLogin_Click" runat="server"></asp:Button>
<div id="error" runat="server"></div>
<div class="login no_account">
<p runat="server">Don't Have An Account Yet?</p>
<p runat="server" class="link">Create one!</p>
</div>
</div>
</div>
<div class="login col2">
<div class="login icon">
<asp:Image runat="server" ImageUrl="~/Img/studying.png" />
</div>
<h2>Course Manager</h2>
<h3>Course Management Made Easy!</h3>
<div class="login info">
<ul>
<li><span>Manage Study information</span></li>
<li><span>Store Module Information</span></li>
<li><span>Auto Self Study Calculations</span></li>
</ul>
</div>
</div>
</div>
</div>
</asp:Content>
Login Styling
#import url(https://fonts.googleapis.com/css?family=Roboto:700);
* {
padding: 0;
margin: 0;
font-family: 'Microsoft YaHei';
}
body {
background-image: url("../Img/background.png");
}
#form {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 1280px;
height: 750px;
border-radius: 8px 8px 8px 8px;
background-color: #252B35;
}
.login .col1 {
background-color: transparent;
float: right;
width: 730px;
height: 750px;
justify-items: self-start;
text-align: center;
}
.login .col1 img {
display: none;
}
.login .col2 {
float: left;
width: 548px;
height: 750px;
text-align: center;
color: #fff;
}
.login .col2 img {
width: 150px;
height: 150px;
margin: 85px auto;
object-fit: cover;
}
.login .col2 .icon {
width: 150px;
height: 150px;
margin: 85px auto;
}
.login .col1 .icon {
width: 150px;
height: 50px;
margin: 0px auto;
}
.login .col1 h2, p, a, label {
color: #fff;
text-decoration: none;
}
.login .col1 .stack {
margin: 25px auto;
height: 450px;
width: 500px;
justify-content: center;
align-items: center;
}
.login .col1 .stack .error {
color: red;
font-size: 14px;
margin: 15px 0px 0px 0px;
text-align: left;
}
.login .col1 .stack input[type=email], input[type=password] {
width: 350px;
height: 35px;
color: #0c0c0c;
margin: 10px 0px 0px 0px;
padding: 7px 15px 7px 5px;
border-radius: 8px;
Font-size: 16px;
outline: none;
border: none;
}
.login .col1 .stack .button {
width: 250px;
height: 45px;
margin: 15px auto;
cursor: pointer;
background-color: transparent;
border: none;
color: #fff;
outline: none;
transition: all 0.3s;
position: relative;
}
.login .col1 .stack .button::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
transition: all 0.3s ease-in-out;
transform: scale(0.1, 1);
}
.login .col1 .stack .button:hover {
background-color: rgba(255,255,255,0.1);
color: #fff;
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: solid;
border-bottom-style: solid;
border-top-color: rgba(255,255,255,0.5);
border-bottom-color: rgba(255,255,255,0.5);
width: 250px;
transition: all 0.3s ease-in-out;
cursor: pointer;
}
.login .col1 .stack .button:hover::before {
opacity: 1;
transform: scale(1, 1);
}
.login .col1 .stack .button::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
transition: all 0.3s;
background-color: rgba(255,255,255,0.1);
}
.login .col1 .stack .forgot-pas {
margin-top: 25px;
cursor: pointer;
}
.login .col1 h2 {
Font-Size: 36px;
margin: 125px 0px 55px 0px;
}
.login .col2 .info {
text-align: center;
margin: 85px auto;
display: inline-table;
font-size: 22px;
Font-weight: bold;
}
/* Allow Responsive design on Login */
#media screen and (max-width: 375px) {
.login .col2 {
display: none;
}
#form {
width: 90%;
height: 90%;
}
.login .col1 {
width: auto;
height: 100%;
margin: auto;
}
.login .col1 img {
width: 80px;
display: inline;
Height: 80px;
margin: 45px auto;
}
.login .col1 {
background-color: transparent;
width: 100%;
height: auto;
justify-items: center;
text-align: center;
margin: auto;
}
.login .col1 h2 {
Font-Size: 26px;
margin: 85px 0px 55px 0px;
}
.login .col1 .stack input[type=email], input[type=password] {
width: 200px;
height: 25px;
color: #0c0c0c;
margin: 10px 0px 0px 0px;
padding: 7px 15px 7px 5px;
border-radius: 8px;
Font-size: 14px;
outline: none;
border: none;
}
.login .col1 .stack {
margin: auto;
height: auto;
width: 100%;
text-align: center;
}
.login .col1 .stack .btn {
margin: 55px 0px 0px;
}
.login .col1 .no_account {
margin: 55px 0px 0px 0px;
}
}
Try using "~/Content/Master.css" without runat="server" attribute.
Sharing here the demo UI. In this UI, I would want to show the CALENDAR outside the parent window just by using CSS. The Calendar should overflow over the Submit/cancel button div n outside that too]1
Code snippet:
Here, the class date-picker-wrp should come outside the complete MODAL box.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%,-50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
overflow: hidden;
}
.zc-form-body {
max-height: 500px;
overflow: auto;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input{
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp{
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker{
text-align: left;
padding: 10px 7px;
}
.zc-form-footer{
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
Expected result:
I want the calendar dom to appear like the dropdown in below shortcut, but ONLY BY USING PURE CSS ( no javascript calculation)
Please refer this JS Fiddle link: https://jsfiddle.net/dilip96025/gzh26fej/28/
Here, the Country dropdown should come outside the box with con class.
As far as I could reproduce your problem with your current included code, you need to remove overflow: hidden from .zc-form > div and remove overflow: auto from .zc-form-body. The cause of your problem was that overflow: hidden really hides everything that goes beyond its own height and width.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%, -50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
}
.zc-form-body {
max-height: 500px;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input {
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp {
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker {
text-align: left;
padding: 10px 7px;
}
.zc-form-footer {
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
test1<br>
test2<br>
test3<br>
test4<br>
test5<br>
test6<br>
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
Edit: second code snippet in answer to comment.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%, -50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
}
.zc-form-body {
max-height: 500px;
overflow: auto;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input {
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp {
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker {
text-align: left;
padding: 10px 7px;
}
.zc-form-footer {
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
test1<br>
test2<br>
test3<br>
test4<br>
test5<br>
test6<br>
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
In the calendar's css add "z-index:1000"
Eg:
<div class="calendar" style="z-index:1000"></div>
I am trying to place a pair of buttons in line of the divs storing images on sides.
Currently i got this but it is not quite what i want:
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
background-color: darkgrey;
height: 100vh;
margin: 0;
/* for centering block both horizontally and vertically */
display: flex;
justify-content: center;
align-items: center;
}
.wrapper {
display: flex;
justify-content: center;
flex-wrap: wrap;
/*maximum 3 items, (320px + 2px border + 0.5rem margin-left + 0.5rem margin-right) � 3 */
max-width: calc(325.33px * 3 + 0.5rem * 6);
}
.wrapper > div {
margin: 0.5rem;
}
img {
width: 323.33px;
max-height: 100%;
}
.border {
border: 1px solid #fff;
position: relative;
}
.txt {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
padding: 10px 20px;
color: white;
}
#media (max-width: 750px) {
.border {
width: calc(50% - 2rem);
}
.border > img {
width: 100%;
}
}
.left {
float: left;
text-align: center;
display: inline-block;
vertical-align: middle;
width: 3.5em;
height: 3.5em;
background: white;
border-radius: 50%;
margin-left: 1.5em;
}
.left:after {
border-radius: 4px;
content: '';
display: inline-block;
margin-top: 0.85em;
margin-left: 0.6em;
width: 1.2em;
height: 1.2em;
border-top: 0.6em solid #333;
border-right: 0.6em solid #333;
-moz-transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
}
.right {
float: right;
text-align: center;
display: inline-block;
vertical-align: middle;
width: 3.5em;
height: 3.5em;
background: white;
border-radius: 50%;
margin-right: 1.5em;
}
.right:after {
border-radius: 4px;
content: '';
display: inline-block;
margin-top: 0.85em;
margin-left: -0.6em;
width: 1.2em;
height: 1.2em;
border-top: 0.6em solid #333;
border-right: 0.6em solid #333;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
<div>
<span class='left' ></span>
<span class= 'right'></span>
<div class="wrapper">
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c119.0.842.842/18299802_1402951239794126_7834789447697694720_n.jpg">
<div class="txt">div text 1</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/17332427_1876651042606993_1501112703702269952_n.jpg">
<div class="txt">div text 2</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c84.0.912.912/16583397_677753229099565_4518661686835544064_n.jpg">
<div class="txt">Omelette du fromage</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/16230268_1353432401412243_430046279255457792_n.jpg">
<div class="txt">How you doin?</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c0.45.1080.1080/14547823_248508785596143_6915357097039233024_n.jpg">
<div class="txt">div text 5</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/15801844_242832729497192_6894626767370190848_n.jpg">
<div class="txt">div text 6</div>
</div>
</div>
</div>
Click "Full page" to get a better view of the snippet.
I tried to use
float with margins but it doesn't work very well:
This is what i am trying to achieve:
Is it possible to change position of those buttons without changing what is inside div with class called wrapper? It would break positioning of those divs. If it was possible to resize buttons with divs in line that would be great!
removed display flex from body
2.
.right {
/* float: right; */ instead of using thing use left: 0;
text-align: center;
display: inline-block;
/* vertical-align: middle; */ not needed
width: 3.5em;
height: 3.5em;
background: white;
border-radius: 50%;
right: 0;
/* margin-top: 50%; */ instead of this, use top: 50% or top: 100%
position: absolute; needs to be absolute pos
top: 100%;
transform: translateY(-50%); this centers the buttons vertically
}
3.
.wrapper {
display: flex;
justify-content: center;
flex-wrap: wrap;
width: 100%;
padding: 0 48px;
}
Working:
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
background-color: darkgrey;
height: 100vh;
margin: 0;
}
.wrapper {
display: flex;
justify-content: center;
flex-wrap: wrap;
/*maximum 3 items, (320px + 2px border + 0.5rem margin-left + 0.5rem margin-right) � 3 */
width: 100%;
}
.wrapper {
display: flex;
justify-content: center;
flex-wrap: wrap;
width: 100%;
padding: 0 48px;
}
img {
width: 323.33px;
max-height: 100%;
}
.border {
border: 1px solid #fff;
position: relative;
}
.txt {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
padding: 10px 20px;
color: white;
}
#media (max-width: 750px) {
.border {
width: calc(50% - 2rem);
}
.border > img {
width: 100%;
}
}
.left {
/* float: right; */
text-align: center;
display: inline-block;
/* vertical-align: middle; */
width: 3.5em;
height: 3.5em;
background: white;
border-radius: 50%;
left: 0;
/* margin-top: 50%; */
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.left:after {
border-radius: 4px;
content: '';
display: inline-block;
margin-top: 0.85em;
margin-left: 0.6em;
width: 1.2em;
height: 1.2em;
border-top: 0.6em solid #333;
border-right: 0.6em solid #333;
-moz-transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
}
.right {
/* float: right; */
text-align: center;
display: inline-block;
/* vertical-align: middle; */
width: 3.5em;
height: 3.5em;
background: white;
border-radius: 50%;
right: 0;
/* margin-top: 50%; */
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.right:after {
border-radius: 4px;
content: '';
display: inline-block;
margin-top: 0.85em;
margin-left: -0.6em;
width: 1.2em;
height: 1.2em;
border-top: 0.6em solid #333;
border-right: 0.6em solid #333;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
<div>
<span class='left' ></span>
<span class= 'right'></span>
<div class="wrapper">
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c119.0.842.842/18299802_1402951239794126_7834789447697694720_n.jpg">
<div class="txt">div text 1</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/17332427_1876651042606993_1501112703702269952_n.jpg">
<div class="txt">div text 2</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c84.0.912.912/16583397_677753229099565_4518661686835544064_n.jpg">
<div class="txt">Omelette du fromage</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/16230268_1353432401412243_430046279255457792_n.jpg">
<div class="txt">How you doin?</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c0.45.1080.1080/14547823_248508785596143_6915357097039233024_n.jpg">
<div class="txt">div text 5</div>
</div>
<div class="border">
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/c135.0.810.810/15801844_242832729497192_6894626767370190848_n.jpg">
<div class="txt">div text 6</div>
</div>
</div>
</div>
I have a big bar of white space below my footer and cant figure out how to remove it. Basically I want everything below the footer to be gone.
Any help appreciated, just learning code so new to this.
https://jsfiddle.net/ptgL5pv6/1/
function active() {
var search_bar = document.getElementById('search_bar');
if (search_bar.value == 'Search') {
search_bar.value = '';
search_bar.placeholder = 'Search';
}
}
function inactive() {
var search_bar = document.getElementById('search_bar');
if (search_bar.value == '') {
search_bar.value = 'Search';
search_bar.placeholder = '';
}
}
body {
background: #efefef;
margin: 0 auto;
font-family: Verdana, Arial, sans-serif;
}
.container {}
.top_section {
background: #000;
padding: 20px;
}
.first_image {
position: relative;
text-align: center;
}
.nav_bar {
background: #222b2f;
border: 10px solid #222B2F;
font-size: 18px;
font-weight: bold;
text-transform: none;
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
}
.nav_bar a {
position: relative;
color: #fff;
Text-decoration: none;
padding: 20px;
}
.nav_bar a:hover {
color: #fff;
Text-decoration: underline;
}
.third_bar {
background: #000;
position: relative;
height: 350px;
}
.second_image {
position: relative;
text-align: center;
height: 370px;
}
#search_bar {
position: relative;
bottom: 50px;
height: 150px;
border: 1px solid #000;
border-right: none;
font-size: 36px;
padding: 10px;
outline: none;
width: 800px;
-webkit-border-top-left-radius: 10px;
-webkit-border-botton-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
right: 110px;
}
#search_button {
position: relative;
width: 200px;
bottom: 222px;
height: 172px;
border: 1px solid #000;
font-size: 36px;
padding: 10px;
background: #f1d826;
font-weight: bold;
cursor: pointer;
outline: none;
-webkit-border-top-right-radius: 10px;
-webkit-border-botton-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
left: 710px;
}
#search_button:hover {
background: #f6e049;
}
.form {
width: 200px;
margin-top: -220px;
padding-left: 280px;
}
.footer {
position: relative;
background: #000;
color: #fff;
bottom: -10px;
}
.copyright {
position: relative;
bottom: -8px;
left: 0;
overflow: hidden;
}
.footer_notes {
position: relative;
text-align: center;
bottom: 10px;
left: 100px;
overflow: hidden;
}
<div id="container">
<div class="top_section">
<div class="first_image">
<img src="logo.png" />
</div>
</div>
<div class="nav_bar">
Home
Search
About us
Products & Pricing
Contact us
login
</div>
<div class="third_bar">
<div class="second_image">
<img src="whisky.png">
</div>
<div class="form">
<form action="search.php" method="post">
<input type="text" id="search_bar" placeholder="" value="Search for your whisky here" max length="30" autocomplete="off" onMouseDown="active();" onBlur="inactive();" />
<input type="submit" id="search_button" value="Go!" />
</form>
</div>
</div>
<div class="footer">
<div class="copyright">
© test.com ®
</div>
<div class="footer_notes">
test.com is a one of a kind fully automated and repsosive database of over 40,000 items. Second to none on ther Internet.
</div>
</div>
</div>
Firt of all, edit this .footer-notes css and remove left:100px; from it. It is making your page width greater then 100%
.footer_notes{
position: relative;
text-align: center;
bottom: 10px;
padding-left: 100px;
overflow: hidden;
max-width:100%;
}
then dont declare height on .third-bar this makes your footer come up even if their is content above the footer
.third_bar{
background:#000000;
position: relative;
}
Even after doing this your footer will have maybe 20px or so space below it because their is not enough content above it. If you want your footer to always stay at bottom in any device then add this to your footer's css.
.footer{
position:fixed;
background: #000000;
color: #ffffff;
bottom:0px;
width:100%;
}
If you go through with all three changes this is what your page will look like :
function active(){
var search_bar= document.getElementById('search_bar');
if(search_bar.value == 'Search'){
search_bar.value=''
search_bar.placeholder= 'Search'
}
}
function inactive(){
var search_bar= document.getElementById('search_bar');
if(search_bar.value == ''){
search_bar.value='Search'
search_bar.placeholder= ''
}
}
body {
background: #efefef;
margin: 0 auto;
font-family: Verdana,Arial,sans-serif;
}
#container{
display:flex;
flex-direction:column;
height:100vh;
overflow:hidden;
background-color:black
}
.top_section {
background:#000000;
padding: 20px;
}
.first_image{
position: relative;
text-align: center;
}
.nav_bar {
background: #222b2f;
border: 10px; solid #222B2F;
font-size: 18px;
font-weight: bold;
text-transform: none;
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
}
.nav_bar a{
position: relative;
color:#ffffff;
text-decoration:none;
padding: 20px;
}
.nav_bar a:hover{
color: #ffffff;
text-decoration:underline;
}
.third_bar{
background:#000000;
position: relative;
}
.second_image{
position: relative;
text-align: center;
height:80vh;
background-image: url("http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/nature-wallpapers-10.jpg");
background-position:center;
background-repeat:no-repeat;
background-size:cover;
}
#search_bar
{
position: relative;
bottom: 50px;
height: 150px;
border:1px solid #000000;
border-right: none;
font-size: 36px;
padding: 10px;
outline:none;
width: 800px;
-webkit-border-top-left-radius:10px;
-webkit-border-botton-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft:10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
right:110px;
}
#search_button
{
position: relative;
width: 200px;
bottom: 222px;
height: 172px;
border: 1px solid #000000;
font-size: 36px;
padding: 10px;
background: #f1d826;
font-weight: bold;
cursor: pointer;
outline: none;
-webkit-border-top-right-radius:10px;
-webkit-border-botton-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright:10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
left: 710px;
}
#search_button:hover
{
background:#f6e049;
}
.form{
width:200px;
margin-top: -300px;
padding-left:280px;
}
.footer
{
position: fixed;
background: #000000;
color: #ffffff;
bottom: 0px;
width:100%;
}
.copyright
{
position: relative;
bottom: -8px;
left: 0px;
overflow: hidden;
}
.footer_notes
{
position: relative;
text-align: center;
bottom: 10px;
margin-left: 100px;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container">
<div class="top_section">
<div class="first_image">
<img src="logo.png"/>
</div>
</div>
<div class="nav_bar">
Home
Search
About us
Products & Pricing
Contact us
login
</div>
<div class="third_bar">
<div class="second_image">
</div>
<div class="form"><form action= "search.php" method="post">
<input type="text" id="search_bar" placeholder="" value="Search for your whisky here" max length="30" autocomplete="off" onMouseDown="active();" onBlur="inactive();"/><input type="submit" id="search_button" value="Go!"/>
</form>
</div>
</div>
<div class="footer">
<div class="copyright">
© test.com ®
</div>
<div class="footer_notes">
test.com is a one of a kind fully automated and repsosive database of over 40,000 items. Second to none on ther Internet.
</div>
</div>
</div>
I have a textbox and a validation message assigned to it. I am trying to put the validation message inline to the textbox, but it comes just under it. I have tried different options but none of them is working. Below is the code for the same:
HTML
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
CSS
input[type=text].vtooltips {
position: relative;
display: inline;
}
input[type=text].vtooltips + span.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: inline-block;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
Here is a Demo for the same.
The desired output is:
Any help will be appreciated. Thanks.
The easiest way is to use CSS Flexbox. Make your <span> a flex container instead of inline-block, just like this:
span {
display: flex;
}
Have a look at the snippet below:
/* CSS used here will be applied after bootstrap.css */
input[type=text].vtooltips {
position: relative;
display: inline;
height: 20px;
}
.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
height: 20px;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: flex;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child .input-holder:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
body {
margin: 30px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-lg-3 wrap">
<span>
<span class="input-holder">
<input type="text" class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName"></span>
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
Hope this helps!
Please do below changes :
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 70%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline;">Please enter Name</span>
</span>
</div>
please refer Demo from here :
Just add below css..
span.vspan{
margin-top: 5px;
display: flex;
}
.wrap span:first-child {
display: flex;
}