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
Related
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>
There are 3 block different size in a row. How can I make them responsive, because in mobile version they overlay at each other.
.watch {
position: absolute;
bottom: 0;
left: 50px;
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
position: absolute;
bottom: 0;
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
position: absolute;
bottom: 20px;
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
Now, they arrange in a row as on image
In mobile version left block disappears and I can not see it, also second and third block overlay at each other.
For mobile devices please try position: relative instead of position: absolute. Don't forget to adjust other CSS values as per your requirements. Hope this will solve your issues
#media all and (max-width: 767px) {
.watch, .mouse, .chat-bot{
position:relative;
right:auto;
left:auto;
top:auto;
bottom:auto;
margin:5px 0
}
}
I have put all the elements inside a div with class footer. and used bootstrap flex css properties to align it. Hope its helps you. thanks
.watch {
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
.footer {
position: absolute;
bottom: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex footer justify-content-sm-center align-content-between flex-sm-wrap flex-lg-nowrap">
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right align-items-center">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
</div>
you can try replacing your existing divs with the below ones
<div class="d-flex justify-content-left col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-center col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-right col-lg-3 col-md-6 col-xs-12">
position:absolute and related properties are not suitable for this function. You can use CSS flexbox layout
For more information use this link: Complete Guide to Flexbox
I explain simple usage of flexbox layout using example:
#wrapper{display:flex;flex-wrap:wrap;justify-content:space-between}
/*just for styles*/
#wrapper div{background-color:#f5f5f5;text-align:center;padding:2px 5px;margin:2px}
#e3{width:200px}
<div id="wrapper">
<div id="e1">element 1</div>
<div id="e2">element 2</div>
<div id="e3">element 3</div>
<div id="e4">element 4</div>
</div>
Also with flex layout you can manipulate elements places based on viewport size with order property.
Trying to position my image without changing the position. When the wind text is turned off(js not working in codepen btw. ) ie not displayed under the temperature, the weatherimage is moving up. I tried to position this 'absolute' but not helping.
I am using reactjs to display the Widget on the right:
<div className="widget">
<div className="row">
<div className="col-lg-12 title">{title}</div>
</div>
<div className="row widgettop">
<div className="col-lg-6 topicon">
<img src={'http://openweathermap.org/img/w/' + icon + '.png'}></img>
</div>
<div className="col-lg-6 topdegrees">
{location}
<div className='degrees'>{degrees}°</div>
{wind && <div>Wind{' '}<span className='wind'>{speed}</span> {unitsType === 'metric' ? <span>km/h</span> : <span>mph</span>}</div>}
</div>
</div>
</div>
Based on the state.wind I display the wind details or not.
How can I keep the image in position when the Wind text/ other content is removed/changed?
codepen here
You can toggle the visibility property for the wind area using JS. The image holds its place when I added visibility: hidden to say #windArea - you can toggle between visible and hidden:
body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-family: Lucida Grande;
}
input,
label {
display: block;
}
#tempArea input,
#tempArea label {
display: inline;
margin-bottom: 10px;
}
#windArea input,
#windArea label {
display: inline;
margin-bottom: 10px;
}
div#main {
background: #F2F2F2;
padding: 1vw 2vw;
width: 48%;
}
.spaceradio {
margin-right: 10px;
}
img {
width: 84% !important;
height: 100% !important;
margin-left: 20%;
position: relative;
}
.divider {
border-left: 1px solid lightgrey;
}
.widget {
box-shadow: 1px 2px 1px lightgray;
background-color: white;
margin-left: 10px;
height: 100%;
width: 90%;
position: absolute;
}
.title {
margin-left: 30px;
padding: 10px;
position: absolute;
}
.left {
margin-left: 20px;
padding: 10px;
vertical-align: top;
}
.text {
height: 40px;
width: 100%;
}
.top {
margin-top: 15px;
}
.widgettop {
margin-top: 15px;
}
.topdegrees {
margin-top: 40px;
}
.topicon {
margin-top: 20px;
}
.degrees {
font-size: xx-large;
font-weight: bold;
}
.wind {
font-size: small;
font-weight: bold;
}
.hline {
border-top: 4px solid blue;
padding: 0 !important;
margin-bottom: 10px;
width: 48%;
}
/* .abs
{
position: absolute;
} */
#windArea { /* ADDED */
visibility: hidden;
}
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="left">
<hr class="container hline">
<div id="main" class="container border">
<div class="row">
<div class="col-lg-6 top"><label for="title">Title</label><input id="title" type="text" placeholder=" Title of widget" name="title" class="text" value="">
<div class="top"><label for="radio">Temperature</label>
<div id="tempArea" class="row"><span class="col-lg-6"><input type="radio" id="one" class="spaceradio" value="metric" checked=""><label for="one">℃</label></span><span class="col-lg-6"><input type="radio" id="two" class="spaceradio" value="imperial"><label for="two">℉</label></span></div>
</div>
<div class="top"><label for="radio">Wind</label>
<div id="windArea" class="row"><span class="col-lg-6"><input type="radio" id="one" class="spaceradio" value="true"><label for="one">On</label></span><span class="col-lg-6"><input type="radio" id="two" class="spaceradio" value="false" checked=""><label for="two">Off</label></span></div>
</div>
</div>
<div class="col-lg-6 divider top">
<div class="widget">
<div class="row">
<div class="col-lg-12 title">FDSFSDFDSFDSFDS</div>
</div>
<div class="row widgettop">
<div class="col-lg-6 topicon"><img src="http://openweathermap.org/img/w/09d.png"></div>
<div class="col-lg-6 topdegrees abs">Paramatta
<div class="degrees">58.12°</div>
<div>Wind <span class="wind">23.04</span> <span>mph</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I'm struggling with the frontend of my page,
When there is a need for content to scroll I am attempting to keep the sidebar, navbar and title bar in the same place whilst allowing the content to scroll.
I thought I had this working until I added a panel to my page which is now causing an overlap. I've deliberately made my textarea massive below to show this.
I can't directly post images yet so heres a link (Edit now I can):
As you can see I'm also struggling to get my panels content to stretch the width of the panel
JSFiddle: https://jsfiddle.net/duwew6ke/
My css file:
.body-content {
padding-left: 15px;
padding-right: 15px;
padding-top: 200px;
}
body {
font-family: "Helvetica Neue",Roboto,Arial,"Droid Sans",sans-serif;
}
.dl-horizontal dt {
white-space: normal;
}
input,
select,
textarea {
max-width: 280px;
}
#sidebar {
position: fixed;
left: 0;
width: 230px;
height: 100%;
border-right: 0.1px solid rgb(225, 225, 225);
margin-top: 60px;
}
#sidebar .sidebar-brand {
height: 50px;
width: 230px;
font-weight: bold;
padding-top:10px;
display: block;
margin: 0;
border-bottom: 0.1px solid rgb(225, 225, 225);
background-color: #fafafa;
font: 500 20px Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
}
#sidebar .sidebar-brand .search {
display: block;
}
#sidebar .sidebar-brand h2 {
margin: 0;
padding-left: 10px;
padding-top: 10px;
}
#navbarwrapper .navbar-inverse {
background-color: white;
border-bottom: 0.1px solid rgb(225, 225, 225);
font-family: 'Indie Flower', cursive;
height: 60px;
position: fixed;
width: 100%;
}
#navbarwrapper .navbar-brand {
font-size: 2em;
margin-top: 10px;
color: #1976d2;
}
#navbarwrapper .userpicture {
height: 50px;
width: 50px;
}
#navbarwrapper .username {
display: block;
margin-top: 30px;
font-size: 20px;
}
#navbarwrapper .bell {
margin-right: 20px;
}
#navbarwrapper .envelope {
margin-right: 20px;
}
#titlenavwrapper {
margin-left: 230px;
margin-top: 60px;
position: fixed;
width: 100%;
}
#titlenavwrapper .navbar-inverse {
height: 50px;
background-color: #1976d2;
font-size: 25px;
color: whitesmoke;
padding-left: 10px;
padding-top: 7px;
}
.body-content {
margin: 0;
margin-left: 230px;
top: 110px;
background-color: #fafafa;
height: 100%;
}
.body-content h2 {
margin: 0;
}
html, body {
height: 100%;
}
The panel code:
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div class="panel">
<div class="panel panel-heading">
<i class="fa fa-telegram"></i> Contact Us!
</div>
<div class="panel panel-body">
<form id="contactform" method="post">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group Name">
<label>Name</label>
<input class="form-control" />
</div>
Layout Code:
<div id="sidebar">
<div class="sidebar-brand">
<span class="text-muted text-center"><i class="fa fa-search"></i>Search...</span>
</div>
</div>
<div id="navbarwrapper">
<nav class="nav navbar-inverse navbar-static-top">
<div class="navbar-brand">
Title
</div>
<div class="navbar profile-area">
<img src="~/Content/img/default.jpg" class="userpicture img-circle pull-right" alt="userpicture"/>
<span class="username pull-right"><i class="bell fa fa-bell"></i><i class="envelope fa fa-envelope"></i> Name</span>
</div>
</nav>
</div>
<div id="titlenavwrapper">
<nav class="nav navbar-inverse navbar-static-top">
<div class="navbar-title">
#ViewBag.Title
</div>
</nav>
</div>
You need to add a z-index to #titlenavwrapper
#titlenavwrapper{
z-index:5;
}
click here for demo
I created a footer and used fontawesome icons with border.
On the following code I display the items and intend to have them as the picture shows
I was nearly there until I found that when I resize the screen, the icons also shrink like the photo show
Here my styling:
$footer: #464646;
.footer-font-awesome{
font-family: 'FontAwesome';
display: inline-block;
width: 40px;
height: 40px;
border: 1px solid white;
border-radius: 50%;
line-height: 40px;
text-align: center;
font-size: 18px;
text-indent: 0;
}
footer#colophon{
background-color: $footer;
color: white;
padding: 20px 40px;
ul,li,p{
margin: 0;
}
.site-info{
.textwidget {
display: flex;
justify-content: center;
div.box{
display: flex;
width: 100%;
max-width: 25%;
align-items: center;
p{
padding-left:8px;
}
}
.email,
.phone,
.address{
padding-right: 40px;
}
.email{
&:before{
#extend .footer-font-awesome;
content: '\f003';
}
}
.phone{
&:before{
#extend .footer-font-awesome;
content: '\f095';
}
}
.back-top{
justify-content: center;
}
.address{
&:before{
#extend .footer-font-awesome;
content: '\f041';
}
}
}
}
}
Here my html structure:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
<section id="black-studio-tinymce-33" class="widget widget_black_studio_tinymce">
<div class="textwidget">
<div class="box email">
<p>Email<br> <span class="unbold"><a>info#web2web.co.za</a></span></p>
</div>
<div class="box phone">
<p>Phone<br> <span class="unbold">021 823 8384</span></p>
</div>
<div class="box address">
<p>Address<br> <span class="unbold">Century City, Cape Town</span></p>
</div>
<div class="box back-top">
<p><span class="unbold"><a class="back-top">To the top</a></span></p>
</div>
</div>
</section>
</div><!-- .site-info -->
</footer>
How can I style my icons as the first pictures shows with no problem even when I resize?
Hope you can edit from my snippet
I would just set min-width on .footer-font-awesome
.footer-font-awesome{
font-family: 'FontAwesome';
display: inline-block;
width: 40px;
min-width: 40px; // This...
height: 40px;
border: 1px solid white;
border-radius: 50%;
line-height: 40px;
text-align: center;
font-size: 18px;
text-indent: 0;
}