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.
Related
I don't know why my H1 is interfering with navbar in mobile version. When I scroll down my navbar in mobile version, H1 interfering to the navbar and I can't fix this issue. How can I change my code, that it works ?
Image in mobile version is here: https://i.stack.imgur.com/SJ3vi.jpg
Code below:
.banner {
background-image: url('../../../assets/images/natallia-nagorniak-tA3sJ4u09eU-unsplash.jpg');
height: 800px;
background-position: center center;
background-size: 100%;
}
.content {
top: 25%;
left: 5%;
position: absolute;
}
.content h1 {
color: black;
font-size: 3em;
font-weight: bold;
}
.content a {
text-decoration: none;
background-color: var(--primary-color);
color: #fff;
padding: 15px 40px;
border-radius: 5px;
}
.content a:hover {
background-color: #64cff7;
color: #fff;
}
.stepBox {
background-color: #64cff7;
padding: 20px 20px;
border-radius: 5px;
text-align: center;
}
.stepBox h1 {
font-size: 30px;
font-weight: bold;
color: black;
}
.stepBox p {
font-size: 20px;
font-style: italic;
color: #fff;
}
.highlight {
color: var(--primary-color);
font-weight: bold;
font-style: italic;
text-decoration: underline;
}
.cakebox {
padding: 10px 5px;
}
.cakebox img {
width: 100%;
height: 250px;
object-fit: cover;
border-radius: 5px;
}
.cakebox h1 {
font-size: 18px;
margin-top: 20px;
font-weight: bold;
}
.viewmorebtn {
text-decoration: none;
background-color: #64cff7;
color: #fff;
padding: 10px 10px;
border-radius: 5px;
font-size: 18px;
}
.viewmorebtn i {
padding-left: 5px;
}
#media screen and (max-width:600px) {
.banner {
height: 600px;
}
}
<div class="banner">
<div class="content">
<h1 class="mb-5">Čerstvé koláče <br/> priamo k tvojim dverám</h1>
<a routerLink="menu">Objednaj teraz! <i class="bi bi-arrow-right"></i></a>
</div>
</div>
<!-- step -->
<div class="container mt-5 mb-5">
<h1 class="text-center">Ako získať <span class="highlight">čerstvé koláče</span></h1>
<div class="row mt-3">
<!-- one -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>1</h1>
<p>vyberte koláč</p>
</div>
</div>
<!-- two -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>2</h1>
<p>vyplnte podrobnosti</p>
</div>
</div>
<!-- three -->
<div class="col-lg-4 mt-2">
<div class="stepBox">
<h1>3</h1>
<p>doručenie vašej objednávky</p>
</div>
</div>
</div>
</div>
<!-- cakebox -->
<div class="container mt-4 mb-4">
<h1 class="text-center">Obľúbené produkty</h1>
<div class="row">
<div class="col-lg-3 mt-3" *ngFor="let ck of cakeData; index as i">
<div class="cakebox" *ngIf="i<=3">
<img src="{{ck.cakeImg}}" />
<h1>{{ck.cakeName}}</h1>
<p>{{ck.cakePrice | currency:'EUR'}}</p>
</div>
</div>
</div>
<a routerLink="menu" class="viewmorebtn">Zobraziť viac<i class="bi bi-arrow-right"></i></a>
</div>
Thank you for your answers!
.content {
top: 25%;
left: 5%;
position: absolute;
}
The container of the h1 is positioned absolutely. The default z-index is causing it to overlap other elements which have a smaller z-index value.
Setting the z-index of the .content div and navbar may help to solve the problem.
.content {
top: 25%;
left: 5%;
position: absolute;
z-index: 10; /** something smaller than the z-index of the navbar **/
}
.navbar {
...
z-index: 20; /** something bigger than the z-index of .content **/
}
Could someone explain me how do I center my text on bottom of the div container?
<div class="container-fluid">
<header id="welcome-header" class="row">
<div id="welcome-div">
<img src="img/logo.png" alt="logo">
<h1 class="welcome-text">
<span>Hi, I'm Robert. I design & build</span>
<br>
<span class="welcome-text-animation"></span>
</h1>
<div class="hire-button">
Yes, I'm available for hire
</div>
<div class="page-scroll ">
<a href="#welcome-div">
Learn more about what i do
<br>
<i class="fa fa-chevron-down"></i>
</a>
</div>
</div>
</header>
Im trying to get "Learn more about what i do" at the bottom of "welcome-header" row.
CSS :
#welcome-div {
min-height: 100%;
position: relative;
}
.page-scroll {
}
.page-scroll a {
font-family: Sansita;
text-decoration: none;
font-size: 20px;
color: aliceblue;
}
Sorry guys u get me wrong. I want the string to stick to bottom like bottom: 0px;
http://codepen.io/anon/pen/jBLaBX
Add position: relative to #welcome-header then position: absolute; bottom: 0; left: 0; right: 0 to .page-scroll to position the element at the bottom of #welcome-header, and your text-align: center rule will center the text horizontally.
#import url('https://fonts.googleapis.com/css?family=Sansita');
#welcome-header {
width: 100%;
height: 100vh;
background-image: url(img/background.jpg);
position: relative;
}
.welcome-text,
.welcome-text-animation {
font-family: Sansita;
text-align: center;
color: aliceblue;
font-size: 50px;
padding-top: 90px;
}
.home-logo {
display: block;
text-align: center;
}
.home-logo img {
display: inline-block;
padding: 2.5%;
width: 120px;
height: 120px;
margin-left: auto;
margin-right: auto;
display: block;
}
.hire-button {
text-align: center;
padding-top: 90px;
}
.hire-button a {
font-family: Sansita;
text-decoration: none;
color: aliceblue;
font-size: 25px;
border: 2px solid #FDCD3B;
border-radius: 50px;
padding: 1.2%;
transition: all 0.2s linear;
}
.hire-button a:hover {
background-color: #FDCD3B;
color: #2A3A3F;
padding-left: 3%;
padding-right: 3%;
}
#welcome-div {}
.page-scroll {
text-align: center;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.page-scroll a {
font-family: Sansita;
text-decoration: none;
font-size: 20px;
color: black;
}
<body>
<div class="container-fluid">
<header id="welcome-header" class="row">
<div id="welcome-div">
<img src="img/logo.png" alt="logo">
<h1 class="welcome-text">
<span>Hi, I'm Robert. I design & build</span>
<br>
<span class="welcome-text-animation"></span>
</h1>
<div class="hire-button">
Yes, I'm available for hire
</div>
<div class="page-scroll ">
<a href="#welcome-div">
Learn more about what i do
<br>
<i class="fa fa-chevron-down"></i>
</a>
</div>
</div>
</header>
<section id="about" class="row">
ABOUT CONTENT
</section>
<section id="skills" class="row">
SKILLS CONTENT
</section>
<section id="portfolio" class="row">
PORTFOLIO CONTENT
</section>
<section id="contact" class="row">
CONTACT CONTENT HERE
</section>
</div>
</body>
.page-scroll {
text-align:center;
}
So, I'm trying to make this boxes that will hold some text and maybe some img brackground, but boxes won't align like they should on a small screen.
I tried a few things, but text won't align on the botton without destroying the alignment
CSS:
.bigbox {
text-align: center;
padding: 80px 40px;
}
.bigbox .bigbox-title {
text-align: left;
font-size: 28px;
color: #fff;
}
.bigbox .bigbox-text {
text-align: left;
font-size: 18px;
color: #fff;
opacity: .85;
margin-bottom: 20px;
}
.smallbox {
text-align: center;
padding: 80px 40px;
}
.smallbox.smallbox-title {
text-align: left;
font-size: 28px;
color: #fff;
}
.smallbox.smallbox-text {
text-align: left;
font-size: 18px;
color: #fff;
opacity: .85;
margin-bottom: 20px;
}
HTML
<div class="full-width-container">
<div class="row no-space-row ">
<div class="col-sm-6 bg-color-base">
<div class="bigbox ">
<h2 class="bigbox-title">BOX 1</h2>
<p class="bigbox-text">DESCRIPTION</p>
</div>
</div>
<div class="col-sm-6">
<div class="smallbox bg-color-purple ">
<h2 class="smallbox-title">BOX 1</h2>
<p class="smallbox-text">DESCRIPTION</p>
</div>
<div class="smallbox bg-color-purple-dark ">
<h2 class="smallbox-title">BOX 1</h2>
<p class="smallbox-text">DESCRIPTION</p>
</div>
</div>
</div>
</div>
The key in this is display:flex on the parent div. This is forcing the two child divs to be the same height.
I have removed the padding from the second div to move it closer to the big box, then position:absoluted the big box title to the bottom of the div.
I've also played with the padding a bit to help with styling - but haven't got it styled to look just like the image above.
.row {
display:flex;
}
.bg-color-base {
background:red;
}
.bg-color-base + div{
padding:0;
}
.bg-color-purple {
background:purple;
}
.bg-color-purple-dark {
background:blue;
}
.bigbox {
text-align: center;
padding: 40px;
position:absolute;
bottom:0;
}
.bigbox .bigbox-title {
align-self: flex-end;
text-align: left;
font-size: 28px;
color: #fff;
}
.bigbox .bigbox-text {
text-align: left;
font-size: 18px;
color: #fff;
opacity: .85;
margin-bottom: 20px;
}
.smallbox {
text-align: center;
padding: 160px 40px 10px;
}
.smallbox.smallbox-title {
text-align: left;
font-size: 28px;
color: #fff;
}
.smallbox.smallbox-text {
text-align: left;
font-size: 18px;
color: #fff;
opacity: .85;
margin-bottom: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="full-width-container">
<div class="row no-space-row ">
<div class="col-xs-6 bg-color-base">
<div class="bigbox ">
<h2 class="bigbox-title">BOX 1</h2>
<p class="bigbox-text">DESCRIPTION</p>
</div>
</div>
<div class="col-xs-6">
<div class="smallbox bg-color-purple ">
<h2 class="smallbox-title">BOX 2</h2>
<p class="smallbox-text">DESCRIPTION</p>
</div>
<div class="smallbox bg-color-purple-dark ">
<h2 class="smallbox-title">BOX 3</h2>
<p class="smallbox-text">DESCRIPTION</p>
</div>
</div>
</div>
</div>
Here you go. The text has to be in an absolutely positioned div.
http://codepen.io/ruchiccio/pen/Kzbeqa
.bcenter {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin-right: auto;
margin-left: auto;
width: 100%;
text-align:center;
}
I have a group of stats styled as shown below, but if I want to center the group, it will use the width of the descriptions that extend past and have a larger width. What's the easiest way to center according to the width of just the stat numbers and still have the descriptions below them?
.container {
text-align: center;
}
.stats {
display: block;
margin: 0 auto 30px auto;
}
.left-stats {
text-align: right;
display: inline-block;
margin-right: 40px;
}
.left-stats .single-stat {
text-align: right;
}
.right-stats {
display: inline-block;
}
.right-stats .single-stat {
text-align: left;
}
.single-stat {
margin-bottom: 20px;
}
.number {
font: 60px"Bebas Neue";
font-weight: bold;
margin-bottom: -5px;
}
<div class="container">
<h3>Header</h3>
<div class="stats">
<div class="left-stats">
<div class="single-stat">
<div class="number">1,200</div>
<div class="desc">Staff on campus supported</div>
</div>
<div class="single-stat">
<div class="number">10</div>
<div class="desc">Departments reached</div>
</div>
</div>
<div class="right-stats">
<div class="single-stat">
<div class="number">06</div>
<div class="desc">Different home states/countries</div>
</div>
<div class="single-stat">
<div class="number">10</div>
<div class="desc">People who love food and technology</div>
</div>
</div>
</div>
</div>
I have a solution using your HTML and using display: table-cell instead of display: inline-block. Instead of a 40px margin to create the space between the columns, I added 20px left/right padding in the relevant elements.
Note that I added dotted blue borders for demonstration purposes, you can remove them.
.container {
text-align: center;
}
.stats {
display: table;
width: 100%;
margin: 0 auto 30px auto;
border: 1px dotted blue;
}
.left-stats {
text-align: right;
display: table-cell;
width: 50%;
padding-right: 20px;
border: 1px dotted blue;
}
.left-stats .single-stat {
text-align: right;
}
.right-stats {
display: table-cell;
width: 50%;
padding-left: 20px;
border: 1px dotted blue;
}
.right-stats .single-stat {
text-align: left;
}
.single-stat {
margin-bottom: 20px;
}
.number {
font: 60px"Bebas Neue";
font-weight: bold;
margin-bottom: -5px;
}
<div class="container">
<h3>Header</h3>
<div class="stats">
<div class="left-stats">
<div class="single-stat">
<div class="number">1,200</div>
<div class="desc">Staff on campus supported</div>
</div>
<div class="single-stat">
<div class="number">10</div>
<div class="desc">Departments reached</div>
</div>
</div>
<div class="right-stats">
<div class="single-stat">
<div class="number">06</div>
<div class="desc">Different home states/countries</div>
</div>
<div class="single-stat">
<div class="number">10</div>
<div class="desc">People who love food and technology</div>
</div>
</div>
</div>
</div>
You mean something like this?
.number {
font: 60px"Bebas Neue";
font-weight: bold;
margin-bottom: -5px;
text-align: center;
}
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