I try to put "datacontain" div below "blue-div", but when blue-div height ++, it covers the "datacontain" div,
how to make "datacontain" div position responsive to blue-div bottom part position ?
Result :
-> i want to make the phonenumber (datacontain div) below blue-div
//style
<style>
.responsive {
width: 100%;
height: auto;
}
.flex-container {
display: flex;
flex-direction: column;
}
.blue-div {
max-width: 70%;
min-width: 70%;
height: 70px;
display: table;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
top:-12%;
/* /transform: translate(-50%, -50%); */
position: absolute;
background-color: #003777;
z-index: 130;
border-radius: 10px;
}
.white-cont {
width: 80%;
height: 215px;
display: block;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
margin-top: -25px;
/* /transform: translate(-50%, -50%); */
position: absolute;
background-color: white;
z-index: 100;
border-radius: 10px;
vertical-align: middle;
box-shadow: 1px 1px 6px 1px #888888;
}
.container-sk {
position: relative;
}
.input-group-addon {
color: gray;
background-color: #ffffff;
}
.datacontain {
margin-top: 50px;
}
.submitButton{
border-radius: 35px;
display: block;
width: 100%;
border: none;
background-color: #ef7c24;
color: white;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
</style>
//html
<img src="<?php echo base_url() . 'assets/img/banner.jpg' ?>" alt="Nature" class="responsive">
<div class="container-sk flex-container" style="background-color:#28abe3; min-height:300px">
<div class="white-cont">
<div class="datacontain col-md-12">
<div class="">
<label>phonenumber</label>
</div>
<div class="">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<img style="height:20px;width:20px" src="<?php echo base_url() . 'assets/img/flag.png' ?>">
+62
</div>
<input class="form-control" id="phonenumber" name="phonenumber" type="text" />
</div>
</div>
<div class="col-md-12 mx-auto">
<button class="submitButton" type="button"> KLAIM VOUCHER </button>
</div>
</div>
</div>
<div class="blue-div" style="">
<label style="color:#fff;font-size:14px;display:table-cell;word-wrap: break-word;vertical-align: middle;" >this is voucher 12345 12345 12354 12345 12345 1234 1234 1234 1234 345 345345 345 345 3 </label>
</div>
</div>
</div>
You need to remove position: absolute; on both the blue div and the white container. If you want the blue div to appear first you also need to move it before the white container in your code.
.responsive {
width: 100%;
height: auto;
}
.flex-container {
display: flex;
flex-direction: column;
}
.blue-div {
max-width: 70%;
min-width: 70%;
height: 70px;
display: table;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
top:-12%;
/* /transform: translate(-50%, -50%); */
background-color: #003777;
z-index: 130;
border-radius: 10px;
}
.white-cont {
width: 80%;
height: 215px;
display: block;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
background-color: white;
z-index: 100;
border-radius: 10px;
vertical-align: middle;
box-shadow: 1px 1px 6px 1px #888888;
}
.container-sk {
position: relative;
}
.input-group-addon {
color: gray;
background-color: #ffffff;
}
.datacontain {
margin-top: 50px;
}
.submitButton{
border-radius: 35px;
display: block;
width: 100%;
border: none;
background-color: #ef7c24;
color: white;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
<div class="container-sk flex-container" style="background-color:#28abe3; min-height:300px">
<div class="blue-div" style="">
<label style="color:#fff;font-size:14px;display:table-cell;word-wrap: break-word;vertical-align: middle;" >this is voucher 12345 12345 12354 12345 12345 1234 1234 1234 1234 345 345345 345 345 3 </label>
</div>
<div class="white-cont">
<div class="datacontain col-md-12">
<div class="">
<label>phonenumber</label>
</div>
<div class="">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
+62
</div>
<input class="form-control" id="phonenumber" name="phonenumber" type="text" />
</div>
</div>
<div class="col-md-12 mx-auto">
<button class="submitButton" type="button"> KLAIM VOUCHER </button>
</div>
</div>
</div>
</div>
</div>
Related
I created a simple component and when I created a flex container, items inside (for example suffix) are out the box, but only in Firefox. I use space-between in flex item, but item is out of the flex container. It works when I set height with of the Input, but that's what I don't want.
I created a CodePen here, because I can't use Sass here in a Stack Snippet.
Does anybody knows about this?
CodePen: https://codepen.io/ondrejko/pen/wvageWg
// Component local variables
$input-border-color: #D8DADC;
$input-border-disabled-color: #E8EAEC;
$input-text-gray: #979797;
$input-text-color: #457CCC;
$input-focus-color: #0284FF;
$input-border-radius: 8px;
$input-font-size: 16px;
$input-height: 40px;
// Base structure
.Input {
position: relative;
max-width: 200px;
}
// Input container for all elements
.Input__container {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
height: $input-height;
background-color: #fff;
font-size: $input-font-size;
}
// Fake input, who replaces real input and is in front of input
.Input__fake-input {
position: absolute;
z-index: 1;
top: 0px;
left: 0px;
width: 100%;
height: inherit;
border-width: 1px;
border-style: solid;
border-color: $input-border-color;
border-image: none;
border-radius: $input-border-radius;
font-size: $input-font-size;
transition: all 0.15s ease-in-out 0s;
}
// Input text field for add text
.Input__field {
z-index: 2;
flex: 1 1 20%;
width: 100%;
height: 100%;
padding: 0px 12px;
border: 0;
color: $input-text-color;
background-color: transparent;
font-size: inherit;
-webkit-appearance: none;
&:focus {
outline: none;
&~.Input__fake-input {
outline: none;
border: 1px solid $input-focus-color;
}
}
}
// Input type PREFIX
.Input__prefix {
z-index: 3;
display: flex;
height: 100%;
align-items: center;
justify-content: center;
padding: 0px 0px 0px 10px;
color: $input-text-gray;
pointer-events: none;
}
// Input type SUFFIX
.Input__suffix {
z-index: 3;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
height: 100%;
padding: 0px 10px 0px 0;
color: $input-text-gray;
}
// Input type ICON
.Input__icon {
position: relative;
z-index: 3;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 48px;
height: calc(100% - 2px);
color: $input-text-gray;
padding: 0px 10px;
border-left: 1px solid $input-border-color;
cursor: pointer;
& img,
svg {
width: 25px;
}
}
// Input type CONTROLS
.Input__controls {
width: 72px;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 0 0 10px;
&+.Input__fake-input {
width: calc(100% - 80px);
}
}
// Input type BUTTON
.Input__button {
width: 32px;
height: 32px;
background: red;
border-radius: 100px;
border: 0;
color: #fff;
padding: 0;
cursor: pointer;
& .Icon {
display: flex;
align-items: center;
justify-content: center;
}
& img,
svg {
max-width: 16px;
}
}
// Modificator --has-status
.Input--has-status {
position: relative;
}
.Input--has-status::after {
content: '';
position: absolute;
top: -4px;
right: -4px;
z-index: 3;
width: 10px;
height: 10px;
border-radius: 100%;
background: #1A73E8;
}
// --has-status types
.Input--has-status.success::after {
background: #37C9AD;
}
.Input--has-status.warning::after {
background: #FFB000;
}
// Modificator --is-invalid
.Input--is-invalid {
& .Input__fake-input {
border: 1px solid #FF0054; // tady barva bude z global variables
}
& .Input__field {
color: #FF0054; // tato barva bude z global variables
&:focus~.Input__fake-input {
border-color: #FF0054; // tady barva bude z global variables
}
}
}
// Modificator --is-disabled
.Input--is-disabled {
& .Input__fake-input {
background-color: $input-border-disabled-color;
color: #868C92;
cursor: not-allowed;
border: 1px solid $input-border-disabled-color;
}
& .Input__field {
color: #868C92;
cursor: not-allowed;
}
}
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,900&display=swap" rel="stylesheet">
<div class="container">
<form>
<div class="row">
<h1> Types</h1>
<h2>Input - default</h2>
<div class="Input">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder">
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - prefix</h2>
<div class="Input">
<div class="Input__container">
<div class="Input__prefix">
<span class="Prefix">Prefix</span>
</div>
<input class="Input__field" type="text" placeholder="Placeholder" value="Lorem ipsum dolor">
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - suffix</h2>
<div class="Input">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder" value="Lorem ipsum dolor">
<div class="Input__suffix">
Suffix
</div>
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - icon</h2>
<div class="Input">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder">
<div class="Input__icon">
<img src="http://www.ondrejkonecny.cz/assets/svg/calculator.svg">
</div>
<div class="Input__fake-input"></div>
</div>
</div>
<br><br>
<h1>Modificators</h1>
<h2>Input - Load Success</h2>
<div class="Input Input--has-status success">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder">
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - Load Warning</h2>
<div class="Input Input--has-status warning">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder">
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - Invalid</h2>
<div class="Input Input--is-invalid">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder" value="Lorem ipsum dolor">
<div class="Input__fake-input"></div>
</div>
</div>
<h2>Input - Disabled</h2>
<div class="Input Input--is-disabled">
<div class="Input__container">
<input class="Input__field" type="text" placeholder="Placeholder" value="Lorem ipsum" disabled>
<div class="Input__icon">
<img src="http://www.ondrejkonecny.cz/assets/svg/calendarDay.svg">
</div>
<div class="Input__fake-input"></div>
</div>
</div>
</div>
</form>
</div>
You are using two types of Input types, and you are referring the same CSS classes to achieve (EX .Input.Input__field,.Input__suffix);
one with Prefix,Suffix with Icon (Input box should occupy 75%, Icon should occupy 25%).
Input Modificators. (A default type: Input box should occupy 100%)
Its better you add a class(ex : .default ) to differentiate the input box with Icon and without Icon like above.
I modified code here # code-pen : https://codepen.io/mediraviteja/pen/OJyrozR
Code changes I did below.
a) Added class ".default" to the container div(EX : ) for all the full width inputs like (Default input, Modificator inputs)
b) Do CSS changes in below class
.Input__field{
width: 100%; -- remove css property
max-width: 76%; -- add css property
}
.Input__suffix{
max-width: 26%; -- add css property
}
**Add new class**
.default .Input__field{
max-width: 100%;
}
.default .Input__suffix{
max-width: 100%;
}
change the HTML element
<div class="Input "> to <div class="Input default">
when ever you need full with Input box like(Default input, Input -Warning,Input - Invalid boxes,etc.)
I have absolutely no idea at this point. I have done everything I could to make sure the arrows and the thumbnail images are centered but somehow, it will not budge... I have even tried the but doesn't seem to make an affect. There is an JS file too but I don't think that really matters so I am not posting on here.
.gallery-outer {
overflow: hidden;
width: 830px;
/*left: 18px;
padding: 0 0 0 5px;*/
height: 250px;
margin-left: -50%;
float: left;
}
.gallery-inner {
float: left;
height: 140px;
position: relative;
width: 3390px;
}
.gallery-tmb {
float: left;
margin: 0 10px 0 0;
}
#gallery {
border-left: 1px solid #E9E9E9;
border-right: 1px solid #E9E9E9;
height: 80px;
margin: 15px;
padding: 0;
position: relative;
width: 400px;
}
#arrow-left {
background:#d1d1d1;
cursor: pointer;
height: 82px;
position: absolute;
left: -7px;
top: 0px;
width: 25px;
}
#arrow-left-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(225deg);
right: 27px;
top:-9px;
}
#arrow-right {
background:#d1d1d1;
cursor: pointer;
height: 82px;
position: absolute;
right: -476px;
top: 0px;
width: 25px;
}
#arrow-right-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(45deg);
right: 49px;
top:-9px;
}
<div id="gallery">
<div id="arrow-left">
<div id="arrow-left-small">
</div>
</div>
<div class="gallery-outer">
<div class="gallery-inner">
<div class="gallery-tmb">
<img src="images/executive1.png" alt="Executive1" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive2.png" alt="Executive2" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive3.png" alt="Executive3" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive4.png" alt="Executive4" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive5.png" alt="Executive5" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive6.png" alt="Executive6" height="auto" width="250"/>
</div>
<div class="gallery-tmb">
<img src="images/executive7.png" alt="Executive7" height="auto" width="250"/>
</div>
</div>
</div>
<div id="arrow-right">
<div id="arrow-right-small">
</div>
</div>
</div>
(function ($) {
$.fn.thumbGallery = function (settings) {
var $this = $(this);
return this.each(function () {
settings = jQuery.extend({
speed: 800,
leftArrow: $this.find('#arrow-left'),
rightArrow: $this.find('#arrow-right'),
galleryContainer: $this.find('.gallery-inner'),
visibleImagesSize: 4
}, settings);
var imgElements = settings.galleryContainer.find('img').length;
var size = settings.visibleImagesSize;
settings.leftArrow.hide();
if (imgElements > settings.visibleImagesSize) {
settings.rightArrow.show();
} else {
settings.rightArrow.hide();
}
function animateLeft() {
var el = settings.galleryContainer.children(":last");
settings.galleryContainer.animate({
left: '+=' + el.outerWidth(true) + 'px'
},
settings.speed);
}
function animateRight() {
var el = settings.galleryContainer.children(":first");
settings.galleryContainer.animate({
left: '-=' + el.outerWidth(true) + 'px'
},
settings.speed);
}
function checkArrows() {
if (size === settings.visibleImagesSize) {
settings.leftArrow.hide();
} else {
settings.leftArrow.show();
}
if (size === imgElements) {
settings.rightArrow.hide();
} else {
settings.rightArrow.show();
}
}
settings.leftArrow.click(function () {
animateLeft();
size--;
checkArrows();
});
settings.rightArrow.click(function () {
animateRight();
size++;
checkArrows();
});
});
};
})(jQuery);
$(document).ready(function () {
$('#gallery').thumbGallery();
});
Solution with use of flexbox.
.gallery-outer {
overflow: hidden;
width: 830px;
/*left: 18px;
padding: 0 0 0 5px;*/
height: 250px;
}
.gallery-inner {
float: left;
height: 100%;
position: relative;
width: 3390px;
}
.gallery-tmb {
float: left;
margin: 0 10px 0 0;
}
#gallery {
border-left: 1px solid #E9E9E9;
border-right: 1px solid #E9E9E9;
display: flex;
justify-content: space-between;
margin: 15px;
padding: 0;
position: relative;
width: 800px;
}
#arrow-left {
background:#d1d1d1;
cursor: pointer;
height: 82px;
width: 25px;
align-self: center;
}
#arrow-left-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(225deg);
right: 27px;
top:-9px;
}
#arrow-right {
background:#d1d1d1;
cursor: pointer;
height: 82px;
width: 25px;
align-self: center;
}
#arrow-right-small {
padding: 10px;
box-shadow: 4px -4px 0 1px black;
position: relative;
display: inline-block;
margin: 40px;
transform: rotate(45deg);
right: 49px;
top:-9px;
}
Flexbox solution
I just built you an example with all the basics.
I don't recommend float abuse, only use it when really needed.
// HOPE IT HELPS
.gallery{
max-width: 600px;
margin: 0 auto;
text-align: center; /* this will center all the inline and inline-block content */
background: purple;
}
.arrow-left,.arrow-right{
width: 100px;
height: 100px;
display: inline-block;
vertical-align: middle;
background: blue;
color: white;
font-size: 5rem; /* just to make arrows show */
}
/* this is just to make the arrows show :p */
.arrow-left:before{
content: '←';
}
.arrow-right:after{
content: '→';
}
/* i'm just between the arrows and also inline (inline-block)*/
.gallery ul{
vertical-align: middle;
background: green;
margin: 0;
padding: 0;
display: inline-block;
}
/* where the images will go (you can use divs instead of ul, li) */
.gallery li {
display: inline-block;
}
img {
background: red;
width: 100px;
height:100px;
}
<div class="gallery">
<div class="arrow-left"></div>
<ul>
<li><img src="#" width=100 height=100 /></li>
<li><img src="#" width=100 height=100 /></li>
<li><img src="#" width=100 height=100 /></li>
</ul>
<div class="arrow-right">
</div>
</div>
You can use a bootstrap template like this:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.thumbnail{
height: 200px;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container-fulid">
<div class="row">
<div class="col-md-2 text-right">
<span class="glyphicon glyphicon-chevron-left" style="margin-top:20%"></span>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2">
<div class="thumbnail">
</div>
</div>
<div class="col-md-2 text-left">
<span class="glyphicon glyphicon-chevron-right" style="margin-top:20%"></span>
</div>
</div>
</div>
</div>
</body>
</html>
I have a 3 rows fluid layout after a media query the css is
html, body {
height : 100%;
margin : 0;
padding : 0;
font-family : Arial, Helvetica, sans-serif;
font-size : 85%;
color : #333399;
}
h1 {
font-size : 380%;
font-weight : bold;
margin : 0;
}
#container {
width: 100%;
}
#header {
width:95%;
height:80px;
float:left;
top:0;
left:0;
}
#indexleft {
display:none;
}
#indexright {
float:left;
top:;
width:85%;
margin: 0 auto;
}
#footer {
float: left;
height: 50px;
left: 0;
width: 100%;
bottom: 0;
position: absolute;
}
#footer p {
text-align: center;
}
.clearCol{
display:none;
}
.space{
display:none;
}
.indexheader {
width: 95%;
text-align:center;
left:0;
top:20px;
margin-bottom:10px;
}
#indexcontainer {
left: 20px;
position: relative;
top: 0;
}
#indexcontainer .indextext{
width : 80%
}
#indexcontainer .formstyle{
width : 80%;
float: left;
margin-top: 10px;
vertical-align: middle;
}
input[type="submit"]:hover {
background-color : #652D91;
color : #FFFFFF;
cursor : pointer;
}
.button, .textfields, .select {
background-color : #BAB3D6;
border : 0;
color : #333399;
margin-bottom : 10px;
padding : 5px;
-webkit-appearance: none;
}
#indexcontainer .textfields {
margin-right: 10px;
width: 250px;
}
<div id="container">
<div id="indexleft">
<div class="top"></div>
<div><img alt="" src="#"></div
</div><div id="header">
<div class="indexheader"><h1>unblock code</h1></div>
</div>
<div> </div>
<div id="indexright">
<div id="indexcontainer">
<div><img alt="" src="#"></div>
<div class="indextext">request yours unblock code (check spam folder)</div>
<div class="formstyle">
<div class="error"> </div>
<form action="#" method="post">
<div><input type="text" name="username" class="textfields">Username</div>
<div><input type="password" name="password" class="textfields">Password</div>
<div><input type="text" name="email" class="textfields">Email</div>
<div><input type="submit" value="Send" name="send" class="button"></div>
</form>
</div>
</div>
</div><div class="clearCol"></div>
<div id="footer">
<p>Copyright © 2001-2017 localhost Conctat us</p>
<!-- **********end footer*********** -->
</div>
</div>
I have 3 problems
Check the snippet for my CSS.
when window is reduced header indexright and footer div overlap
Description text slips below instead of above textfield
I want header and footer fixed and index-right fluid
Don't know if I understood everything correctly, but this should be close.
PS, use form labels.
html,
body {
height: 100%;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 85%;
color: #333399;
}
h1 {
font-size: 380%;
font-weight: bold;
margin: 0;
}
#container {
width: 100%;
}
#header {
width: 95%;
top: 0;
left: 0;
}
#indexleft {
/*display:none;*/
}
#indexright {
float: left;
top: ;
width: 85%;
margin: 0 auto;
}
#footer {
float: left;
height: 50px;
left: 0;
width: 100%;
bottom: 0;
position: absolute;
}
#footer p {
text-align: center;
}
.clearCol {
display: none;
}
.space {
display: none;
}
.indexheader {
width: 95%;
text-align: center;
left: 0;
top: 20px;
margin-bottom: 10px;
}
#indexcontainer {
left: 20px;
position: relative;
top: 0;
}
#indexcontainer .indextext {
width: 80%
}
#indexcontainer .formstyle {
width: 80%;
float: left;
margin-top: 10px;
vertical-align: middle;
}
#indexcontainer .formstyle div{
clear: both;
}
input[type="submit"]:hover {
background-color: #652D91;
color: #FFFFFF;
cursor: pointer;
}
.button,
.textfields,
.select {
background-color: #BAB3D6;
border: 0;
color: #333399;
margin-bottom: 10px;
padding: 5px;
-webkit-appearance: none;
}
#indexcontainer .textfields {
margin-right: 10px;
width: 250px;
float: left;
}
.formstyle label{
line-height: 23px;
}
#media (max-width: 700px) {
#footer {
clear: both;
position: static;
float: none;
}
}
<div id="container">
<div id="indexleft">
<div class="top"></div>
<div>
<a href="#">
<img alt="" src="#">
</a>
</div </div>
<div id="header">
<div class="indexheader">
<h1>unblock code and if text is long header div overlap</h1>
</div>
</div>
<div> </div>
<div id="indexright">
<div id="indexcontainer">
<div>
<img alt="" src="#">
</div>
<div class="indextext">request yours unblock code (check spam folder)</div>
<div class="formstyle">
<div class="error"> </div>
<form action="#" method="post">
<div>
<label>Username</label>
<input type="text" name="username" class="textfields"></div>
<div>
<label>Password</label>
<input type="password" name="password" class="textfields"></div>
<div>
<label>Email</label>
<input type="text" name="email" class="textfields"></div>
<div>
<input type="submit" value="Send" name="send" class="button">
</div>
</form>
</div>
</div>
</div>
<div class="clearCol"></div>
<div id="footer">
<p>Copyright © 2001-2017 localhost Conctat us
</p>
<!-- **********end footer*********** -->
</div>
</div>
<div class="dispLoginSearch"> <!-- LOGIN AND SEARCH -->
<div class="loginBox">
<div class="loginTopHolder hidOverflow">
<div class="floatLeft setCenter hidOverflow" style="width: 45%;">
<span class="myText">My</span>
<br /><br />
<span class="wmText">Login</span>
</div>
<div class="floatRight hidOverflow" style="height: 100%; background: #FF0000;">
<div class="hidOverflow brClear" style="height: 50%; background: #0000FF;">
<input type="submit" name="ctl00$SubmitLoginNM" value="Login" id="ctl00_SubmitLoginNM" class="styledBtn logBtn floatLeft lightLinks" />
</div>
<div class="hidOverflow brClear" style="height: 50%; font-size: small; display: table-cell; vertical-align: bottom;">
Register a New Account
<br />
Forgot Username/Password
</div>
</div>
</div>
</div>
</div> <!-- LOGIN AND SEARCH -->
CSS:
CSS:
.dispLoginSearch {
width: 40%;
height: 100%;
vertical-align: middle;
float: right;
padding-right: 2%;
background: #FFFFFF;
overflow: hidden;
text-align: center;
margin: 0 auto;
}
.loginBox {
margin-top: 3%;
border: 1px solid #d4d4d4;
display: block;
width: 95%;
font: 16px sans-serif;
padding: 0 0 0 15px;
border-radius: 5px;
-webkit-font-smoothing: antialiased;
text-align: left;
overflow: auto;
}
.loginTopHolder {
width: 95%;
margin: 5px 5px 5px 5px;
height: 85px;
}
.hidOverflow {
overflow: hidden;
}
.setCenter {
text-align: center;
}
.brClear {
clear: both;
}
.floatLeft {
float: left;
}
.floatRight {
float: right;
}
Output:
I want the green DIV to get the 50% of the height and align the text bottom, but can't seem to get it done.
Please help me resolve it.
The parent element should be defines as position: absolute; so the child elements width and height depends on that
I am creating following wizard.
I have tried following; but its not working as it should be. Its layout disturbs while resizing window. It should be responsive. What can be best way to implement it so that it should remain Responsive despite whatever resolution is.
Fiddle with issue
HTML:
<div class="col-md-10">
<div class="wizard-wrapper">
<div class="node-wrapper text-center wactive">
<div class="node"><span>1</span>
</div>
<label class="lbl-wizard">Singn Up</label>
</div>
<div class="node-wrapper text-center">
<div class="node"><span>2</span>
</div>
<label class="lbl-wizard">Order Info</label>
</div>
<div class="node-wrapper text-center">
<div class="node"><span>3</span>
</div>
<label class="lbl-wizard">Preview Info</label>
</div>
<div class="node-wrapper text-center">
<div class="node"><span>4</span>
</div>
<label class="lbl-wizard">Payment Method</label>
</div>
<div class="node-wrapper text-center">
<div class="node"><span>5</span>
</div>
<label class="lbl-wizard">Complete Order Info</label>
</div>
<div class="connection"></div>
</div>
</div>
CSS
/* wizard */
.wizard h2 {
margin-top: 5px;
}
.node {
background: #2d2f32;
border-radius: 30px;
color: #fff;
display: inline-block;
height: 37px;
text-align: center;
width: 37px;
border: 4px solid #C2C6C9;
}
.wactive .node {
background: #AA0405;
}
.node > span {
display: inline-block;
font-size: 14px;
padding-top: 4px;
font-family: open_sansbold;
}
.lbl-wizard {
display: block;
font-family: open_sansregular;
font-size: 14px;
color: #2d2f32;
padding-top: 5px;
}
.node-wrapper.text-center {
float: left;
padding: 0 5%;
position: relative;
z-index: 1;
}
.connection {
background: #c2c6c9;
display: inline-block;
height: 5px;
margin-top: -113px;
padding-top: 7px;
position: relative;
vertical-align: middle;
width: 100%;
z-index: 0;
}
FYI: I am using bootstrap.
You can set the width of a node.wrapper element to one fifth of the resolution width.
width: calc(100% / 5);
Also, you should change .connection so it stays at one position:
.connection {
background: #c2c6c9;
display: block; (new)
height: 5px;
margin-top: 38px; (new)
padding-top: 7px;
position: absolute; (new)
vertical-align: middle;
width: 100%;
z-index: 0;
}
Fiddle