Aligning text in a flexbox - html

We were asked to design and code a website for high school lesson.
I've designed it in figma and then started coding (more like suffering ahahha) in replit.
I designed both the header and the main text to be at the same level in figma., but when i started writing the code, the paragraph text is slightly shifted to the left comparing with the header.
I've tried to align them using align items and margings and stuff like that, though i dont fully understand how they work yet tbh.
If anyone knows what to do, and is willing to spend a little of their time looking into the code,
i will be very thankful!!!!!!!!!
This is a non-comercial high school homework task.
if you need more details about the project, just ask :)
the css code:
.logo2{
padding-left: 65%;}
h2{
display: flex;
font-family: 'Annie Use Your Telescope', cursive;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 63px;
color: #000000;
text-shadow: 4px 2px 0.5px #b4deb3, 0 0 1em #b4deb3;
}
.container2 { display: flex; flex-direction: column; padding: 8%;
}
.container2 div{
border: 1px solid greenyellow; padding: 10px;
}
.image1{display: flex; flex-direction: row; }
.imag1, .text1 {flex:50%;}
.imag1, .imag2, .imag3 {display: flex; justify-content: center; align-items: center;}
.image2 { display: flex; flex-direction: row;}
.imag2, .text2 {flex:50%}
.image3 { display: flex; flex-direction:row;}
.imag3, .text3 {flex:50%}
.text1, .text2, .text3 {text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); display: flex; align-items: left; justify-content: left; text-align: left; flex-direction: column;}
.but1 {text-align: center; line-height: 1em }
.gs {
font-family: Athiti;
font-style: normal;
font-weight: normal;
font-size: 40px;
line-height: 160.5%;
}
.onedayticket {
padding-left: 15%;
font-family: Athiti;
font-style: normal;
font-weight: normal;
font-size: 28px;
line-height: 160.5%;
align-items: left;
color: #000000;
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);}
.but1 {filter: drop-shadow(8px 9px 14px rgba(254, 193, 233, 0.71)); width: 286.79px;
height: 70px;
left: 1026px;
top: 2496px;
background: rgba(255, 255, 255, 0.68);
border: 0.5px solid #000000;
box-sizing: border-box;
box-shadow: 0px 4px 4px #B4DEB3;
font-family: Athiti;
font-style: normal;
font-weight: normal;
font-size: 28px;
line-height: 45px;
display: flex;
align-items: center;
text-align: center;
color: #000000;}
the html code:
<section class="third" id="shop">
<div class = "container">
<div class ="container2">
<div class="image1">
<div class="imag1">
<img class= "tickets" src="tck/green.png">
</div>
<div class="text1">
<header class="gs"> Green submarine </header>
<p class="onedayticket"> The one-day ticket. Lets you expore our music festival for a single day of you choice</p>
<button class="but1"> Buy ticket </button>
</div>
</div>
<div class="image2">
<div class="imag2">
<img class= "tickets2" src="tck/blue.png">
</div>
<div class="text2">
<header1 class="gs"> The Eggman </header1>
<p class="onedayticket"> The three-day ticket. Enjoy any three days of the festival with this ticket</p>
<button class="but1"> Buy ticket </button>
</div>
</div>
<div class="image3">
<div class="imag3">
<img class= "tickets3" src="tck/pink.png">
</div>
<div class="text3">
<header1 class="gs"> The Walrus </header1>
<p class="onedayticket"> Expanded VIP ticket.
During our week-long festival all the concerts are open for you at any time. </p>
<button class="but1"> Buy ticket </button>
</div>
</div>
</div>
</div>
</section>

I'm not sure if this is what you're looking for. Remove padding-left: 15%; on onedayticket because this is pushing the text to the right.

Related

How to set Horizontal/Inline multiple view using Google App Script for Gmail Addon Plugin

How to set Horizontal/Inline multiple view using Google App Script for Gmail Addon Plugin.
I have prepared the demo for the vertical views but I don't know how to set the view Horizontally/Inline which is shown in the below image.
I have also tried with the help of HTML file but may be it's not rendering perfectly.
https://i.imgur.com/ZCbUUvw.png
Index.html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.d-flex{
display: flex
}
.text-center{
text-align: center;
}
.header-section{
border-bottom: 1px solid;
border-bottom-color: rgba(0, 0, 0, 0.12);
padding: 10px;
}
.header-image{
background-color: #eaeaea;
text-align: center;
width: 36px;
height: 36px;
background-size: cover;
border-radius: 100%;
padding: 0;
margin-right: 12px;
}
h1.header-title{
margin: 0;
font-size: 16px;
}
h2.header-subtitle{
margin: 0;
font-size: 14px;
}
h3.body-section-title{
font-size:13px;
}
.mail-list-item{
display: flex;
flex-direction: row;
align-items: center;
/* justify-content: space-between; */
margin-bottom: 16px;
}
h4.f-l-name{
font-size: 14px;
margin: 0;
}
h5.mail{
font-size: 13px;
color: rgba(0, 0, 0, 0.4);
margin: 0;
}
h4.company-name{
font-size: 14px;
margin: 0;
padding: 0 0 10px 0;
border-bottom: 1px solid;
border-bottom-color: rgba(0, 0, 0, 0.12);
}
.upload-deck-btn{
margin-top: 42px;
text-transform: uppercase;
align-items: center;
padding: 10px;
gap: 10px;
width: 114px;
height: 36px;
background: #0F99FF;
border-radius: 4px;
color: #fff;
border: none;
}
.add-deal-btn{
text-transform: uppercase;
align-items: center;
padding: 10px;
gap: 10px;
width: 114px;
height: 36px;
background: #0F99FF;
border-radius: 4px;
color: #fff;
border: none;
}
</style>
</head>
<body>
<div class="header-section d-flex">
<div class="header-image"></div>
<div>
<h1 class="header-title">Fintee Seed Tound</h1>
<h2 class="header-subtitle">James McAvoy</h2>
</div>
</div>
<div class="body-section">
<h3 class="body-section-title">Who's the founder?</h3>
<div class="mail-list">
<div class="mail-list-item">
<div>
<h4 class="f-l-name">First Last Name</h4>
<h5 class="mail">Email#gmail.com</h5>
</div>
<input type="checkbox">
</div>
<div class="mail-list-item">
<div>
<h4 class="f-l-name">First Last Name</h4>
<h5 class="mail">Email#gmail.com</h5>
</div>
<input type="checkbox">
</div>
</div>
<h4 class="company-name">Company Name</h4>
<div class="text-center">
<input type="button" value="Upload Deck" class="upload-deck-btn">
<div class="d-flex">
<h4>Invite Founder to complete profile?</h4>
<input type="checkbox" >
</div>
<h3 class="add-deal-msg">Add this deal to Outpost?</h3>
<input type="button" value="Add Deal" class="add-deal-btn" >
</div>
</div>
</body>
</html>
Code.gs
function htmlFun() {
var html = HtmlService.createTemplateFromFile('Index').evaluate().getContent();
return CardService.newCardBuilder()
.addSection(CardService.newCardSection().addWidget(CardService.newKeyValue().setContent(html)))
.build();
}
Need to do like shown in image either it's using google script or using html inside google script.

Keep symbol and text on same line?

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>

How to move underline using border-bottom to make it look like a underline using box-shadow inset?

Simple question:
Can I make the underline using border-bottom (the ones on the right side) look exactly like the ones using box-shadow (the ones on the left side)?
I need it to be CSS only. And it may span across multiple lines as you can see from the snippet.
Basically I need to move the border-bottom a little bit up and not mess with everything else.
#import url('https://fonts.googleapis.com/css?family=Proxima+Nova');
div.flex {
display: flex;
width: 420px;
justify-content: space-between;
}
div.flex2 {
display: flex;
width: 300px;
justify-content: space-between;
}
h2 {
font-family: 'Proxima Nova';
color: rgb(60,128,124);
font-size: 21px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 10px;
}
a.boxShadow {
color: darkGrey;
text-decoration: none;
line-height: 26px;
box-shadow: inset 0 -2px white, inset 0 -4px 0 rgb(60,128,124);
padding-bottom: 3px;
}
a.borderBottom {
color: darkGrey;
text-decoration: none;
line-height: 26px;
border-bottom: 2px solid rgb(60,128,124);
}
<div class="flex">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
<div class="flex2">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
REASON FOR THIS QUESTION (BROWSER CONSISTENCY):
The box-shadow example does exactly what I want, but it does not look good on Edge (and I'm afraid other browsers might not render it properly as well). It looks perfect on recente versions of Chrome, Firefox and Safari though.
On Edge, the box-shadow example looks like this (see small line leaking at the bottom):
On the other hand, border-bottom seems to render consistently across browsers. But I can't get the underline in the position that I need.
Gradient can do this
#import url('https://fonts.googleapis.com/css?family=Proxima+Nova');
div.flex {
display: flex;
width: 420px;
justify-content: space-between;
}
div.flex2 {
display: flex;
width: 300px;
justify-content: space-between;
}
h2 {
font-family: 'Proxima Nova';
color: rgb(60,128,124);
font-size: 21px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 10px;
}
a.boxShadow {
color: darkGrey;
text-decoration: none;
line-height: 26px;
box-shadow: inset 0 -2px white, inset 0 -4px 0 rgb(60,128,124);
padding-bottom: 3px;
}
a.borderBottom {
color: darkGrey;
text-decoration: none;
line-height: 26px;
background:
linear-gradient(rgb(60,128,124),rgb(60,128,124))
bottom 1px center/ /* Position */
100% 2px /*width height*/
no-repeat;
}
<div class="flex">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
<div class="flex2">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>

Position of text in mobile version of web page

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.

I cant make pictures go side by side

I've tried to make an About Us page for my website but it doesn't seem like I can make the pictures go side by side. And by the way, I have looked at other posts but I don't really understand it.
.Button {
background-color: Plum;
border: 1px solid;
border-color: black;
padding: 10px 25px;
text-align: center;
display: inline-block;
font-size: 16px;
font-family: hacked;
border-radius: 8px;
text-color: black;
text-shadow: 2px 2px grey;
}
.sub {
position: relative;
}
.itmHolder {
position: relative;
}
.itmHolder:nth-child(2),
.itmHolder:nth-child(3) {
position: absolute;
top: 0;
}
.og {
margin-top: 50px;
position: center;
text-align: center;
}
h1 {
font-size: 400%;
color: Plum;
text-shadow: 4px 4px Black;
}
pre {
font-size: 100%;
color: Plum;
text-shadow: 2px 2px Black;
}
body {
background-image: url("lightning.gif");
background-repeat: no-repeat;
-webkit-transform: rotateX(0);
background-size: cover;
background-position: center center;
min-height: 100vh;
}
a:link,
a:visited {
color: black;
text-align: center;
text-decoration: none;
display: inline-block;
}
.img-with-text {
text-align: justify;
width: [400px];
}
.img-with-text img {
display: block;
margin: 0 auto;
}
pret {
font-size: 200%;
color: Plum;
text-shadow: 2px 2px Black;
}
<body background="background.jpg">
<form action="selve websiten.html">
<div class="og">
<div class="itmHolder">
<div class="sub">
<button type="button" class="Button">Frontpage</button>
<button type="button" class="Button">Buy now</button>
</div>
<font size=6>
<pre style="font-family:kenyan coffee;">
Hello, our names is William and Emal.
We've made this website for our own interest and trying to make a future for us.
We are 14 and 15 years of age and, we both live in southern Denmark.
On this website we will mostly be selling steam items, games and etc.
But in the future its possible we are going to be selling other stuff like clothing, cups and etc.</pre>
</font>
<div class="img-with-text">
<img src="emal.png" alt="Emal" style="width:400px;height:400px;" />
<center>
<pret style="font-family:easycore;">Emal Sahari, Owner and Founder of Future</p>
</center>
</div>
<div class="img-with-text">
<img src="william.jpg" alt="William" style="width:400px;height:400px;" />
<center>
<pret style="font-family:easycore;">William Lauritsen, Owner and Founder of Future</p>
</center>
</div>
</body>
Let's try that :
.container_img {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
and
<div class="container_img">
<div class="img-with-text">
<img src="emal.png" alt="Emal" style="width:400px;height:400px;" />
<center><pret style="font-family:easycore;">Emal Sahari, Owner and Founder of Future</p></center>
</div>
<div class="img-with-text">
<img src="william.jpg" alt="William" style="width:400px;height:400px;" />
<center><pret style="font-family:easycore;">William Lauritsen, Owner and Founder of Future</p></center>
</div>
</div>
You mean <img src="emal.png"> and <img src="william.jpg"> go side by side?
try put them into inline-block element
<div>
<span class="imgWrapper"><img src="emal.png"></span>
<span class="imgWrapper"><img src="william.jpg"></span>
</div>
<style>
.imgWrapper{
display:inline-block;
width:///;
height:///;
}
.imgWrapper img{
width:100%;
}
</style>