Position of text in mobile version of web page - html

I have a slider, and text inside it, and I need to make this text responsive. I mean in computer version it looks like as I want, but in mobile version it shifts and I can`t see my icons under each other.
css:
.sliderr__item .slid{
display: flex;
flex-direction: column;
width: 100%;
margin-left: 50px;
margin-top: 50px;
text-align: left;
align-items: flex-start;
justify-content: flex-start;
}
/*END*/
.sliderr {
background-color: #fff;
position: relative;
overflow: hidden;
width: 100%;
}
.sliderr__wrapper {
display: flex;
transition: transform 0.6s ease;
/* ADDED: */
margin-bottom: 10px;
}
.sliderr__item {
flex: 0 0 50%;
}
.sliderr .date {
display: inline-block;
margin-left: 1em;
}
/* Added: */
.sliderr__controls {
display: flex;
justify-content: center;
flex-flow: row;
}
.sliderr__control {
/* Added: */
border-radius: 50%;
/* Updated: */
position: relative;
top: 0;
width: 25px;
/* The Same: */
display: flex;
align-items: center;
justify-content: center;
color: #fff;
text-align: center;
height: 25px;
background: #5FA467;
/*
REMOVED: transform: translateY(-50%);
*/
}
html:
<div class="sliderr"><br>
<div class="sliderr__wrapper">
<div class="sliderr__item" style="border: 1px solid #DCE2EC;">
<div style="height: 150px;" class="slid">
<p style="font-family: Roboto; font-size: 14px; color: #5FA467;">My first text</p><br>
<p style="font-family: Roboto; font-size: 16px; color: #000; font-weight: bold;">My second text</p><br>
<p style="display: inline-block; font-family: Roboto; font-size: 14px; color: #000;"><img src="https://via.placeholder.com/20" style="width: 18px; height: 18px;"><span>My User</span><img src="https://via.placeholder.com/20" style="margin-left: 20px;"> 21.08.2018</p>
</div>
</div>
<div class="sliderr__item" style="border: 1px solid #DCE2EC;">
<div style="height: 150px;" class="slid">
<p style="font-family: Roboto; font-size: 14px; color: #5FA467;">My first text</p><br>
<p style="font-family: Roboto; font-size: 16px; color: #000; font-weight: bold;">My second text</p><br>
<p style="display: inline-block; font-family: Roboto; font-size: 14px; color: #000;"><img src="https://via.placeholder.com/20" style="width: 18px; height: 18px;"><span>My User</span><img src="https://via.placeholder.com/20" style="margin-left: 20px;"> 21.08.2018</p>
</div>
</div>
</div>
</div>
So, I have 3 paragraph of text and in mobile version I need to see them in the center and under each other and icons need to be under each others with their text. How can I make that? Full sample in this JSFiddle https://jsfiddle.net/ofzpnL2k/4/

You can use CSS media queries to achieve different stylink for mobile. It's like if conditionals for CSS.
Here you can find more explanation about it: https://www.w3schools.com/csSref/css3_pr_mediaquery.asp.

Related

height adjust of the content based on additional length of data

I have list of tools in a 2x2 grid layout, the problem here is sometimes the tool image and tool name have either more height based on there image and name. So i have read that we should not keep the image width and height. What i want to achieve is that if the second column has more content it should align exactly same. So that my Add to Cart will align exactly same
.tools-list-container {
display: grid;
grid-gap: 16px;
grid-template-columns: repeat(auto-fill, minmax(min(136px, 100%), 1fr));
}
.tool-card-container {
background: #ffffff;
border: 1px solid #e1e4e7;
box-sizing: border-box;
border-radius: 8px;
padding: 12px;
}
.tool-image-container img {
width: 100%;
object-fit: cover;
height: 80px; // to adjust the height
}
.tool-name {
font-weight: 600;
font-size: 14px;
line-height: 20px;
margin-top: 20px;
}
.tool-description{
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 20px;
margin-top: 2px;
}
.tool-amount-action-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 6px;
}
.tool-our-price {
font-weight: 600;
font-size: 19px;
line-height: 20px;
}
.tool-mrp {
font-style: normal;
font-weight: 400;
font-size: 13px;
line-height: 20px;
}
.button-wrapper {
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
background: grey;
border: 1px solid grey;
cursor: pointer;
}
<div class="tools-list-container">
<div class="tool-card-container">
<div class="tool-image-container"><img src="https://picsum.photos/id/237/200/300" alt="Tool one"></div>
<div class="tool-name">Test Tool 1</div>
<div class="tool-description">1.25 kg of weight</div>
<div class="tool-amount-action-container">
<div class="tool-amount-container"><span class="tool-our-price">₹9</span><span class="tool-mrp">10</span></div>
<div class="action-container">
<div class="button-wrapper" style="padding: 7px 11px; font-size: 15px;">
<div class="button-text">Add to cart</div>
</div>
</div>
</div>
</div>
<div class="tool-card-container">
<div class="tool-image-container"><img src="https://picsum.photos/id/237/200/400" alt="Tool two"></div>
<div class="tool-name">Test Tool more detail name 2</div>
<div class="tool-description">1 kg of weight</div>
<div class="tool-amount-action-container">
<div class="tool-amount-container"><span class="tool-our-price">₹9</span><span class="tool-mrp">10</span></div>
<div class="action-container">
<div class="button-wrapper" style="padding: 7px 11px; font-size: 15px;">
<div class="button-text">Add to cart</div>
</div>
</div>
</div>
</div>
</div>
If i add below snippet then i will be able to control the height of the image
.tool-image-container img {
width: 100%;
object-fit: cover;
height: 80px;
}
but i don't know inside a grid how can i control the text height so if tool name is more than also it the content of two column align exactly same. so that the Add to cart will be same across every row
Any help is appreciated

Trying to make div move to another div

So I am trying to make it look like this
However, it currently looks like this
As, you can see the top section with the logo and register have their own section. I want it to stay on top of the background image. I do not want to use position: absolute; or position : fixed; since i want it to say in its own section. I have also tried using a negative margin and it does not work. Any help is appreciated.
.top-firstsection {
display: flex;
}
.logo-header {
height: 80px;
}
.nav-list {
margin-left: auto;
list-style: none;
display: flex;
}
.leftandright {
display: flex;
justify-content: space-between;
}
.login {
font-family: Helvetica;
font-size: 13px;
color: #000000;
letter-spacing: 0.98px;
text-align: center;
text-decoration: none;
line-height: 26px;
cursor: pointer;
}
.register {
font-family: Helvetica;
font-size: 13px;
color: #0972D7;
letter-spacing: 0.98px;
text-align: center;
text-decoration: none;
line-height: 26px;
}
.first-left {
padding-top: 220px;
padding-left: 171px;
}
.first-left h1 {
font-family: Poppins-Regular;
font-size: 40px;
color: #000000;
letter-spacing: 0;
line-height: 50px;
}
.sectionOne-textbox {
border: 1px solid #EBEBEB;
border-radius: 4px;
font-family: Helvetica;
font-size: 14px;
color: #000000;
letter-spacing: 1.05px;
line-height: 52px;
width: 80%;
}
.sectionOne-button {
background: #1F8FFB;
border-radius: 4px;
border: 1px solid;
padding: 16px 25px;
font-family: Helvetica;
font-size: 13px;
color: #FFFFFF;
letter-spacing: 1.3px;
text-align: center;
margin-top: 24px;
}
<section class="first-section">
<div class="top-firstsection">
<img src="logo.svg" alt="logo" class="logo-header">
<ul class="nav-list flex">
<li>
LOGIN
</li>
<li>
REGISTER
</li>
</ul>
</div>
<div class="leftandright">
<div class="first-left">
<h1>Open marketplace <br> for ordering & purhasing <br> scientific experiments</h1>
<input type="text" id="" class="sectionOne-textbox" placeholder="Discover new experiments...">
<button class="sectionOne-button">GET STARTED NOW!</button>
</div>
<div class="first-right">
<img src="firstsectionbackground.png" alt="main graphic" class="main-graphic">
</div>
</div>
</section>

background-color doesn't work when using flexbox

I started using flexbox for my footers and now on all of my pages with forms the background-color is now the default white. Here is an example of one of my pages:
login.php
body {
background-color: #211e1e;
display: flex;
flex-direction: column;
height: 95vh;
}
h1 {
color: #99cc00;
text-align: center;
}
.content {
flex: 1 0 auto;
}
footer {
text-align: center;
font-weight: lighter;
color: #99cc00;
font-size: 10px;
flex-shrink: 0;
}
h3 {
position: absolute;
font-weight: bold;
color: #99cc00;
font-size: 15px;
width: 100%;
top: 91.5%;
}
.button {
background-color: #211e1e;
color: white;
font-size: 24px;
/*padding: 15px 50px;*/
transition-duration: .4s;
border: greenyellow;
width: 250px;
/* width of button */
height: 50px;
/* height of button */
}
.buttonColor:hover {
color: black;
background-color: greenyellow;
}
h1 {
text-align: center;
bottom: 25%;
}
content {
align-items: center;
justify-content: center;
}
.signin {
color: #99cc00;
margin: auto;
font-size: 24px;
}
.loginInput {
font-size: 24px;
}
.loginButton {
background-color: #211e1e;
color: white;
font-size: 24px;
padding: 10px 50px;
transition-duration: .4s;
border: greenyellow;
}
.loginButtonColor:hover {
color: black;
background-color: greenyellow;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="../../favicon.ico">
<meta charset="UTF-8">
<title>TapLovers</title>
<link rel="stylesheet" href="../background.css">
<link rel="stylesheet" href="login.css">
</head>
<body>
<div class=content>
<h1><img src="../../36x36-icon.png">apLovers</h1>
<form class="signin">
<input type="text" email="email" placeholder="Email" class="loginInput"><br>
<input type="text" password="password" placeholder="Password" class="loginInput"><br>
<input type="submit" name="submit" id="login" class="loginButton loginButtonColor" value="Login To TapLovers!" /><br><br>
<a href="../register/register.php">
<font color="#99cc00">Create a FREE TapLovers Account!</font>
</a>
</form>
</div>
<footer>
<h3><img src="../../favicon.ico">apLovers</h3><br>&copy 2018 TapLovers, All Rights Reserved
</footer>
</body>
</html>
Also I was trying to center my forms and my title using flexbox as well and I haven't gotten that working either. I'm not really sure what other details would be useful for this particular problem. If you need any more details just reply below and I'll answer them as they come out.
EDIT: The snippet that compiles on stack overflow shows my background just fine. What's more is if I use ctrl+shift+i on my page then the background works but if I just reload on my page then the background will turn white.
I did not see the issue with background fluctuations. I think it is a delay in the page load. I have added comments to help with the flexbox centering of items.
/*CSS reset of browser agent. Removes the horizontal scroll currently happening in page.*/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #211e1e;
display: flex;
flex-direction: column;
/* No need to restrict the height.
height: 95vh;*/
}
h1 {
color: #99cc00;
text-align: center;
}
.content {
flex: 1 0 auto;
/*make the content div flex so that the form can take the center alignment from flexbox properties. Add the centering here and avoid the margin: auto property */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
footer {
text-align: center;
font-weight: lighter;
color: #99cc00;
font-size: 10px;
flex-shrink: 0;
}
h3 {
position: absolute;
font-weight: bold;
color: #99cc00;
font-size: 15px;
width: 100%;
top: 91.5%;
}
.button {
background-color: #211e1e;
color: white;
font-size: 24px;
/*padding: 15px 50px;*/
transition-duration: .4s;
border: greenyellow;
width: 250px;
/* width of button */
height: 50px;
/* height of button */
}
.buttonColor:hover {
color: black;
background-color: greenyellow;
}
h1 {
text-align: center;
bottom: 25%;
}
/*Add flexbox style the inputs as blocks and remove <br> from HTML*/
.signin {
color: #99cc00;
font-size: 24px;
display: flex;
flex-direction: column;
}
.signin>* {
margin: 5px 0;
}
.loginInput {
font-size: 24px;
}
.loginButton {
background-color: #211e1e;
color: white;
font-size: 24px;
padding: 10px 50px;
/*Please check your animation ??
transition-duration: .4s;*/
/*add border size and transparency 1px solid*/
border: 1px solid greenyellow;
}
.loginButtonColor:hover {
color: black;
background-color: greenyellow;
}
<div class="content">
<h1><img src="../../36x36-icon.png">apLovers</h1>
<form class="signin">
<input class="loginInput" placeholder="Email" type="text"> <input class="loginInput" placeholder="Password" type="text"> <input class="loginButton loginButtonColor" id="login" name="submit" type="submit" value="Login To TapLovers!"> <font color="#99CC00">Create a FREE TapLovers Account!</font>
</form>
</div>
<footer>
<h3><img src="../../favicon.ico">apLovers</h3>
<p>© 2018 TapLovers, All Rights Reserved</p>
</footer>

How do I get my text to align my picture?

This is the look:
How do I move the text up? So its centered besides the image?
CSS:
header{
padding: 20px;
background-color: #34495e;
color: black;
}
.header-1{
color: white;
padding: 0px 190px;
font-size: 17px;
vertical-align: middle;
line-height: 20px;
}
.logopng{
width: 35px;
height: 35px;
}
HTML:
<header>
<div class="header-1">
<img src="http://i.imgur.com/cGlBmw7.png" class="logopng">
Rocket League Prices
</div>
</header>
EDIT: added vertical-align:middle to the image class
The easiest way is to set display: flex and align-items: center on parent element.
header {
padding: 20px;
background-color: #34495e;
color: black;
}
.header-1 {
color: white;
font-size: 17px;
display: flex;
align-items: center;
}
.logopng {
width: 35px;
height: 35px;
margin-right: 20px;
}
<header>
<div class="header-1">
<img src="http://i.imgur.com/cGlBmw7.png" class="logopng">Rocket League Prices
</div>
</header>
you can use css3 flexbox concept.just add
display:flex;
align-items:center;
justify-content:center;
to your .header-1 it works fine.I'm added the snippet below.
header{
padding: 20px;
background-color: #34495e;
color: black;
}
.header-1{
color: white;
font-size: 17px;
display:flex;
align-items:center;
justify-content:center;
}
.logopng{
width: 35px;
height: 35px;
margin-right:10px;
}
<header>
<div class="header-1">
<img src="http://i.imgur.com/cGlBmw7.png" class="logopng">
Rocket League Prices
</div>
</header>

how to show two different font size ,2 different texts using html,css

1st text part has two lines. 2nd text line has only one line. Here, I attached the image:
How do I do this using css?
<td class="right-col">
<div>
<div>
<span>average<br>cost</span>
</div>
<div>
<span>$2,500</span>
</div>
</div>
</td>
Try to this way
define class on your div and some write css according to your design.
.mainDiv{
padding: 20px;
background: #fcfcfc;}
.left-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 11px;
line-height: 13px;
}
.right-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 23px;
margin-left: 5px;
}
<div class="mainDiv">
<div class="left-text">
<span>average<br>cost</span>
</div>
<div class="right-text">
<span>$2,500</span>
</div>
</div>
One of the many ways you can do this.
.container {
width: 200px;
background: #E0E0E0;
font-size: 0;
font-family: sans-serif, serif;
padding: 20px;
}
.column {
color: #757575;
font-size: 16px;
display: inline-block;
width: 50%;
padding: 10px;
box-sizing: border-box;
vertical-align: middle;
}
.txt-left {
text-align: left;
font-size: 24px;
}
.txt-right {
font-size: 12px;
text-align: right;
}
<div class="container">
<div class="column txt-right">
<span>AVERAGE<br>COST</span>
</div>
<div class=" column txt-left">
<span>$2,500</span>
</div>
</div>
.right-col div {
table-layout: fixed;
font-family: Arial, sans-serif;
text-transform: uppercase;
background: linear-gradient(to bottom, #f7f8f8 0%,#fbfbfb 56%,#f5f6f6 74%,#e8e9e9 100%);
line-height: 10px;
font-size: 10px;
color: #85929c;
display: table;
width: 200px;
}
.right-col div span {
vertical-align: top;
display: table-cell;
padding: 10px 3px;
}
.right-col .text {
text-align: right;
}
.right-col .amount {
line-height: 20px;
font-size: 18px;
}
<table class="table">
<tbody>
<tr>
<td class="right-col">
<div>
<span class="text">average<br>cost</span>
<span class="amount">$2,500</span>
</div>
</td>
</tr>
</tbody>
</table>