How can I achieve this using css?
This is what I've tried:
<label style="position:absolute; top:-15px; margin-left: 20px; font-size:18px"">R$</label>
<label style="margin-left:45px; font-size: 35px;>54.133</label>
<label style="position:absolute; top:-15px;>48</label>
I think you dont even need that, just a little bit beautifuler
Origin
$234 07-04
After add style
<p style="font-size: 30px; font-weight: lighter; color: rgba(57, 152, 27, 0.97);"><sup style="font-size: 15px;">$</sup>234<sup style="font-size: 15px;">07-04</sup></p>
Please use downbelow style, dont mix html and style, that's terrible
.normal{
font-size: 30px;
font-weight: normal;
color: rgba(57, 152, 27, 0.97);
}
.upper{
font-weight: lighter;
font-size: 15px;
}
<p class="normal">
<sup class="upper">$</sup>234<sup class="upper">07-04</sup>
</p>
label{
font-size:20px;
}
label sup{
font-size: 12px;
vertical-align: top
}
<label><sup>R$</sup>54.133<sup>73</sup></label>
Use superscript tag
<label><sup>R$</sup>54.133<sup>73</sup></label>
https://www.w3schools.com/tags/tag_sup.asp
This is the css solution to achieve the superscript.Just try this:
<label style="position:relative; top:-0.5em; margin-left: 20px; font-family: 'Segoe UI Light'; font-size:18px"">R$</label>
<label style="margin-left:45px; font-size: 35px; font-family: 'Segoe UI Light'" runat="server" id="lblBalancePeriod">54.133</label>
<label style="position:relative; top:-0.8em;">48</label>
HTML:
<span class="currency">
<span class="prefix">R$</span>
54.133
<span class="suffix">73</span>
</span>
CSS:
.currency {
color: green;
font-size: 40px;
line-height: 40px;
}
.prefix, .suffix {
font-size: 20px;
vertical-align: text-top;
}
Shown in Plunker.
You can use flexbox:
<div class="container">
<label class="sign">R$</label>
<label class="number">54.133</label>
<label class="decimal";>48</label>
</div>
<style>
.container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
label.sign{
align-self: flex-start;
font-size: 20px;
}
label.number{
font-size: 30px;
}
label.decimal{
align-self: flex-start;
font-size: 20px;
}
</style>
More Here
Related
So I've been formatting this form and it looks ok on Desktop now.
But I need it to change when it's on mobile.
It's two elements, one image and one form, side by side.
I need them to change to top and bottom when on mobile.
Probably a #media query CSS?
I've tried using percentages for widths, but the image size isn't changing and the form component either ends up overlapping it, or it gets cut off...
HTML Code:
<head>
<link rel="stylesheet" href="/assets/signup.css">
</head>
<!-- Begin Mailchimp Signup Form -->
<div id="mc_embed_signup">
<div id="image"><img src="images/genesis.gif"></div>
<form action="https://opipets.us17.list-manage.com/subscribe/post?u=3fa8d83aedc08e2a8814c787c&id=27f9c81072&v_id=4140&f_id=00bb56e0f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Join our Whitelist</h2>
<div class="mc-field-group">
<label for="mce-EMAIL">Email
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
<span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
</div>
<div id="mergeRow-gdpr" class="mergeRow gdpr-mergeRow content__gdprBlock mc-field-group">
<div class="content__gdpr">
<span>
<fieldset class="mc_fieldset gdprRequired mc-field-group" name="interestgroup_field">
<label class="checkbox subfield" for="gdpr_90860"><input type="checkbox" id="gdpr_90860" name="gdpr[90860]" value="Y" class="av-checkbox gdpr"></label>
</fieldset>
<p><b>I agree to receive communications from Opis Group Ltd</b></p>
</span>
<br>
<p>Your privacy is our policy. Occasionally, we'll contact you about our products and services, and other content that may be of interest. You can unsubscribe at any time.</p>
<p>We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. </p>
<br>
<p>Learn more about Mailchimp's privacy practices here.</p>
</div>
</div>
<div hidden="true"><input type="hidden" name="tags" value="6456416,6456520"></div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_3fa8d83aedc08e2a8814c787c_27f9c81072" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->
CSS Code:
#font-face {
font-family: museo-sans;
src: url(/fonts/museosans_300.otf) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 300;
font-stretch: normal
}
#font-face {
font-family: museo-sans-bold;
src: url(/fonts/museosans_700.otf) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 700;
font-stretch: normal
}
#font-face {
font-family: bwstretch;
src: url(/fonts/BWSTRETCH-BLACK.OTF) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 800;
font-stretch: normal
}
a {
font-family: museo-sans-bold;
color: #ffc860;
}
h2 {
font-family: bwstretch;
text-align: center;
text-transform: uppercase;
font-size: 3vh !important;
}
body {
font-size: 1.5vh;
background-color: #191f43;
font-family: museo-sans;
color: #191f43;
}
#mc_embed_signup {
width: 90% overflow: auto;
height: 90%;
display: flex;
align-items: center;
justify-content: center;
vertical-align: middle;
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
color: #191f43;
}
div.mc-field-group {
width: 90% overflow: auto;
}
div.mc-field-group label {
font-size: 2vh;
font-family: museo-sans-bold;
width: auto;
}
div.mc-field-group input {
font-size: 1.5vh;
font-family: museo-sans-bold;
width: 90%;
color: #191f43;
border: 0;
height: 30px;
border-radius: 5px;
padding-left: 10px;
padding-bottom: 10px;
padding-top: 10px;
margin-left: 10px;
}
#image {
max-width:30% overflow: auto;
background-color: #191f43;
}
#content__gdpr {
display: flex;
justify-content: center;
align-items: center;
}
#mc_embed_signup {
width: 90%;
background-color: #191f43;
color: #ffc860;
font-family: museo-sans;
}
#mc-embedded-subscribe-form input[type=checkbox]{
display: flex;
width: auto;
margin-right: 0px;
margin-left: -15px;
margin-top: -2px;
}
#mergeRow-gdpr {
margin-top: 20px;
font-size: 1.5vh;
}
#mergeRow-gdpr fieldset label {
font-weight: normal;
}
#mc-embedded-subscribe-form .mc_fieldset {
border:none;
min-height: 0px;
padding-bottom:0px;
}
input.button {
color: #191f43;
background-color: #ffc860;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 45px;
padding-right: 45px;
font-family: bwstretch;
text-transform: uppercase;
font-size: 1.5em;
border: 0;
border-radius: 40px;
}
span {
display: flex;
align-items: center;
}
#Media works like this:
#media (max-width: 768px) {
h2{
background-color: #ffc860;
}
}
768px is generally regarded as a breaking point between vertical(smartphone) view and horizontal(Tablet, Desktop) view.
I would recommend to do every class twice one for bellow 768px screen width and one for above.
I have this kind of grid on my web. I want it to make responsive for mobiles and tablets. I attached the screenshot of what I have now and What I want. Thanks in Advance!
When I check this on my mobile, this happens :(
How can I make it look like this
Here is my source code
.row {
display: flex;
flex-direction: row;
justify-content: center;
}
.box {
width: 20%;
height: auto;
margin-top: 12px;
background-color: rgba(0, 0, 0, 0.5);
align-items: center;
justify-content: center;
position: relative;
text-align: center;
margin: auto;
padding: 16px;
}
.box.big {
width: 40%;
margin-top: 24px;
}
<div class="row">
<div class="box">
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 400; margin-top: 8px; font-size: 2.15vw; ">AIRFREIGHT</p>
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 200; font-size: 1.2vw; margin-bottom: 8px;">CHINA & EU to CIS via GYD<br>CHARTERING IN CHINA<br>EU TO GYD & SCO</p>
</div>
<div class="box">
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 400; margin-top: 8px; font-size: 2.15vw;">SEA FREIGHT</p>
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 200; font-size: 1.2vw; margin-bottom: 8px;">SEA FREIGHT SERVICES VIA<br>POTI PORT, GE TO ASIA, EU<br>AND AMERICAS</p>
</div>
<div class="box">
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 400; margin-top: 8px; font-size: 2.15vw;">ROAD FREIGHT
</p>
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 200; font-size: 1.2vw; margin-bottom: 8px;">EU TO CIS VIA SOUTHERN<br>CORRIDOR<br>LTL SERVICES FROM EU</p>
</div>
<div class="box">
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 400; margin-top: 8px; font-size: 2.15vw;">RAIL FREIGHT</p>
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 200; font-size: 1.2vw; margin-bottom: 8px;">RAIL FREIGHT BETWEEN<br>AZE TO CIS AND POTI PORT<br>TERMINAL HANDLING IN AZ</p>
</div>
</div>
<div class="row">
<div class="box big">
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 400; margin-top: 8px; font-size: 2.15vw;">VALUE ADDED SERVICES</p>
<p style="font-family: 'Kanit', sans-serif; color: #ffffff; font-weight: 200; font-size: 1.2vw; margin-bottom: 8px;">LTL SERVICES TO CIS<br>RORO / BREAKBULK SERVICES IN CASPIAN<br>VESSEL AGENCY SERVICES<br>CUSTOMS CLEARANCE AND TRANSIT FORMALITIES<br>APPLYING SPECIAL PERMITS & FEASIBILITY STUDY</p>
</div>
</div>
I experimented and got the answer. All i had to do is add some css code. This will help alot)
#media (max-width: 600px) {
.logo{
margin-top: 0;
height: 48px;
}
.row{
margin-top: 80px;
display: flex;
flex-direction: column;
}
.box {
margin:12px;
width: 90%;
padding: 16px;
}
.box.big{
width: 90%;
padding: 16px;
}
.boxTextHeader{
font-size: 5vw;
}
.boxTextDescription{
font-size: 3vw;
}
}
I've changed some html too by adding classes to make it more customizeable. This css is enough to get and idea.
I've got this and it's not working
.header {
text-align: center;
background: #9f7a2b;
color: white;
}
span.nowrap {
white-space: nowrap;
}
span.title {
font-family: 'Computer Modern Serif', georgia;
font-variant: small-caps;
display: block;
text-align: center;
letter-spacing: .4em;
font-size: 2.3rem;
}
<div class="header">
<img src="./images/3d-graph-model.png" style="padding: 15px 0px 22px 0px" alt="3-d graph" class="center">
<span class="nowrap">∘<span class="title">My Title</span></span>
<p>My supercool header</p>
</div>
I want the circle symbol and the "My Title" text on the same line, but the symbol tight, not spaced at the beginning of the line. Now I get the symbol above the title line. Any ideas what I'm doing wrong?
You added display: block; property to the span.title element. As the result, the element is stretched to full available width. You can use a following code to solve your problem.
.header {
display: flex;
flex-direction: column;
align-items: center;
background: #9f7a2b;
color: white;
}
span.nowrap {
white-space: nowrap;
}
span.title {
font-family: 'Computer Modern Serif', georgia;
font-variant: small-caps;
letter-spacing: .4em;
font-size: 2.3rem;
}
<div class="header">
<img src="./images/3d-graph-model.png" style="padding: 15px 0px 22px 0px" alt="3-d graph" class="center">
<span class="nowrap">∘<span class="title">My Title</span></span>
<p>My supercool header</p>
</div>
Replace
<span class="nowrap">∘<span class="title">My Title</span></span>
by
<div class="title"><span class="symbol">∘</span>My Title</div>.
Look the following code:
.header {
text-align: center;
background: #9f7a2b;
color: white;
}
.symbol {
font-size: 1.8rem;
}
.title {
font-family: 'Computer Modern Serif', georgia;
font-variant: small-caps;
display: block;
text-align: center;
letter-spacing: .4em;
font-size: 2.3rem;
}
<div class="header">
<img src="./images/3d-graph-model.png" style="padding: 15px 0px 22px 0px" alt="3-d graph" class="center">
<div class="title"><span class="symbol">∘</span>My Title</div>
<p>My supercool header</p>
</div>
You can fix your problem using display: flex; and align-items: center; Then the content will show inline... here are my code check it hope it will help you :)
.header {
text-align: center;
background: #9f7a2b;
color: white;
}
span.nowrap {
white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
}
span.title {
font-family: 'Computer Modern Serif', georgia;
font-variant: small-caps;
display: block;
text-align: center;
letter-spacing: .4em;
font-size: 2.3rem;
}
<div class="header">
<img src="./images/3d-graph-model.png" style="padding: 15px 0px 22px 0px" alt="3-d graph" class="center">
<span class="nowrap">∘<span class="title">My Title</span></span>
<p>My supercool header</p>
</div>
i have 3 sections in this html 3 page, header, inner body, and footer, i would like you to focus on the inner body only, in there, i have a form, and an information box with title and text, i would like to make the form and information box to be centered in the inner body, and to sit side by side , and the information box to be in the middle of the form height.
body{
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.content {
width: 1400px;
margin: auto;
padding: 10px;
}
/* inner body styling */
#import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
div.inner-body {
background-image: url(image/blueimage.png);
margin-bottom: 20px;
margin-top: 20px;
height: 900px;
text-align: center;
align-items: center;
display: grid;
}
form {
font-family: Verdana, Geneva, Tahoma, sans-serif;
margin-top: 80px;
align-items: center;
border-radius: 40px;
width: 525px;
height: 700px;
background-color: rgb(99, 198, 223);
box-shadow: 0px 15px 20px rgba(0,0,0,0.5);
}
.signin {
font-size: 35px;
padding: 10px;
width: 530px ;
height: 500px;
display: inline-block;
background-color: rgb(173, 241, 241);
border-radius: 30px;
margin-top: -50px;
margin: 10px;
box-shadow: 0px 15px 20px rgba(0,0,0,0.5);
margin-right: 50px;
}
.signin-intro {
color: black;
}
.passlabel {
white-space: pre;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-style: oblique;
}
.stafflabel {
white-space: pre;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-style: oblique;
}
.field {
width: 500px;
font-size: 25px;
font-style: oblique;
}
.error {
color: red;
font-size: 15px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-weight: bold;
}
.error1 {
color: red;
font-size: 15px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.userlogo {
width: 200px;
border-radius: 100px;
margin-top: -15px;
}
.area {
width: 280px;
height: 30px;
border-radius: 20px;
font-size: 20px;
padding: 5px;
font-style: oblique;
}
.btn {
width: 400px;
height: 40px;
font-size: 30px;
border-radius: 20px;
background-color: rgb(54, 88, 238);
cursor: pointer;
}
.account-link {
font-size: 20px;
}
.checkbox {
display: inline-flex;
font-size: 20px;
}
.remember {
white-space: pre;
}
form .pass-link a:hover,
form .account-link a:hover{
text-decoration: underline;
}
.pass-link {
white-space: pre;
}
.remember-me {
width: 20px;
height: 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="signin.css">
<script src="signin.js"></script>
<title>Document</title>
</head>
<body>
<div class= "content">
<div class="inner-body">
<div class ="signin">
<h3><u>Staff Members Sign In</u></h3>
<p class="signin-intro"> This sign in form is meant for staff memebers only, if you are a student, please use this link
Student Account </p>
</div>
<form method="GET" onsubmit=" return formSubmit() " action="#">
<div class="userimage">
<img class="userlogo" src="image/userlogo.png" alt="Picture- User Profile picture">
</div><br>
<div class="error" id= "errorMsg"></div><br>
<div class="error" id= "errorMsg1"></div>
<div class="field">
<label class="stafflabel"> Staff Name </label>
<input class="area" placeholder="staffmember or admin" onclick=" return userValidation()" onchange=" return userValidation()" id="staff" name="staff" type="text">
</div> <br>
<div class="error" id= "errorMsg2"></div>
<div class="field">
<label class="passlabel"> Password </label>
<input class="area" placeholder="password" onclick=" return userValidation()" onchange=" return userValidation()" id="pass" name="pass" type="password">
</div><br>
<div class="checkbox">
<input type="checkbox" class="remember-me">
<label class="remember" for="remember-me">Remember me </label>
<a class="pass-link" href="#"> Forgot password? </a>
</div><br><br><br>
<div class="field">
<input class="btn" type="submit" value="Sign in">
</div> <br>
<div class="account-link">
Didn't create an account yet? Create Account
</div>
</form>
</div>
</div>
</body>
</html>
You can use display: flex; to achieve this easier.
Here is the CodePen: https://codepen.io/Juka99/pen/qBVJdNv
Use flex, remove margin-top, and everything works perfectly. :)
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.