I am trying to get my <a> tags centered in div#teacherpageoptions. They are centered in Microsoft Expression Web, but not when I view the page in a browser. What am I doing wrong?
#blackbar {
background-color: chartreuse;
padding: 10px;
height: 57px;
}
html {
height: 100%;
}
body,
#teacherpage {
min-height: 100%;
background-color: #f4f4f4;
}
hr {
visibility: hidden;
}
.center {
padding-bottom: 50px;
padding-top: 50px;
}
.button {
display: block;
width: 115px;
height: 25px;
background: chartreuse;
padding: 10px;
text-align: center;
border-radius: 5px;
color: white;
font-weight: bold;
}
.button1 {
display: block;
width: 115px;
height: 25px;
background: #008dde;
padding: 10px;
border-radius: 5px;
color: white;
font-weight: bold;
position: absolute;
}
p {
color: white;
font-weight: bold;
line-height: 40px;
}
.auto-style1 {
/* Make username hang a little to the left. */
margin-left: 53px;
}
#teacherpage {
height: 327px;
background-color: gray;
}
#teacherpageoptions {
margin-left: auto;
margin-right: auto;
height: auto;
}
.auto-style2 {
margin-right: 0px;
}
.wrapper {
text-align: center;
}
.auto-style3 {
margin-bottom: 0px;
}
a {
height: 100%;
opacity: 0.5;
width: 100%;
}
a:hover {
opacity: 1;
-webkit-transform: scale(3);
-ms-transform: scale(3);
transform: scale(3);
}
<div id="blackbar" class="auto-style3">
Logout
<p style=" float:right; height: 36px;" class="auto-style1">Username
<?php session_start(); echo $name=$ _SESSION[ 'name'] ?>
</p>
</div>
<hr>
<div id="teacherpageoptions">
<div class="wrapper" style="height:100px "> Make Questions
<div class="center"></div>
Make Exam
</div>
</div>
Remove the position: absolute; from the .button1 and add margin: 0 auto; instead.
#blackbar {
background-color: chartreuse;
padding: 10px;
height: 57px;
}
html {
height: 100%;
}
body,
#teacherpage {
min-height: 100%;
background-color: #f4f4f4;
}
hr {
visibility: hidden;
}
.center {
padding-bottom: 50px;
padding-top: 50px;
}
.button {
display: block;
width: 115px;
height: 25px;
background: chartreuse;
padding: 10px;
text-align: center;
border-radius: 5px;
color: white;
font-weight: bold;
}
.button1 {
display: block;
width: 115px;
height: 25px;
background: #008dde;
padding: 10px;
border-radius: 5px;
color: white;
font-weight: bold;
/* position: absolute; */
margin: 0 auto;
}
p {
color: white;
font-weight: bold;
line-height: 40px;
}
.auto-style1 {
/* Make username hang a little to the left. */
margin-left: 53px;
}
#teacherpage {
height: 327px;
background-color: gray;
}
#teacherpageoptions {
margin-left: auto;
margin-right: auto;
height: auto;
}
.auto-style2 {
margin-right: 0px;
}
.wrapper {
text-align: center;
}
.auto-style3 {
margin-bottom: 0px;
}
a {
height: 100%;
opacity: 0.5;
width: 100%;
}
a:hover {
opacity: 1;
-webkit-transform: scale(3);
-ms-transform: scale(3);
transform: scale(3);
}
<div id="blackbar" class="auto-style3">
Logout
<p style=" float:right; height: 36px;" class="auto-style1">Username
<?php session_start(); echo $name=$ _SESSION[ 'name'] ?>
</p>
</div>
<hr>
<div id="teacherpageoptions">
<div class="wrapper" style="height:100px "> Make Questions
<div class="center"></div>
Make Exam
</div>
</div>
You can delete the "position:absolute" and put "margin:0 auto" instead.
Let me know how it worked.
Related
Im making a pricing page for my website but as I'm making my website responsive, (only when the page is less than 110 pixels wide),
* {
margin: 0;
padding: 0;
font-family: "Poppins", sans-serif;
}
#pricing {
height: 95vh;
width: 100vw;
background-color: #E5EDFB;
margin-top: none;
}
h1 {
color: #0E0A24;
padding-left: 8.75%;
padding-top: 5vh;
font-size: 300%;
}
h2 {
color: #0E0A24;
text-align: center;
margin-top: 4vh;
font-weight: 600;
font-size: 175%;
}
p {
color: #0E0A24;
text-align: center;
font-weight: 300;
}
span {
font-size: 120%;
font-weight: 400;
}
.smallTile {
background-color: white;
width: 23vw;
height: 65%;
border-radius: 15px;
}
.largeTile {
background-color: white;
width: 28vw;
height: 70%;
border-radius: 15px;
}
#photo {
margin-left: 8.75%;
position: relative;
top: 27%;
transform: translateY(-27%);
float: left;
}
#video {
margin-right: 8.75%;
position: relative;
top: 27%;
transform: translateY(-27%);
float: right;
}
#combo {
margin-right: 8.75%;
position: absolute;
left: 50%;
top: 60%;
transform: translate(-50%, -60%);
}
hr {
margin-top: 6%;
margin-bottom: 6%;
width: 20%;
position: relative;
left: 50%;
transform: translateX(-50%);
background-color: #0E0A24;
border: none;
height: 0.1px;
;
}
.topHR {
width: 50%;
margin-top: 4vh;
margin-bottom: 4vh;
height: 2px;
border-radius: 1px;
;
}
#comboHeader {
font-weight: 900;
font-size: 200%;
}
#media screen and (max-width: 1100px) {
body {
background-color: red;
}
.smallTile {
display: block;
position: relative;
width: 86vw;
height: 95vh;
}
.largeTile {
display: block;
position: relative;
width: 86vw;
}
#photo {}
#video {
margin-top: 100vh;
}
#combo {
margin-top: 100vh;
position: relative;
}
h1 {
margin-bottom: 20px;
}
}
<div id=p ricing>
<h1>Our Pricing:</h1>
<div class="smallTile" id="photo">
<h2>Photography<br>Plan</h2>
<hr class="topHR">
<p><span>0 - 10 Pictures</span><br>$100</p>
<hr>
<p><span>10 - 20 Pictures</span><br>$175</p>
<hr>
<p><span>20+ Pictures</span><br>$250</p>
</div>
<div class="smallTile" id="video">
<h2>Videography<br>Plan</h2>
<hr class="topHR">
<p><span>0 - 5 Videos</span><br>$100</p>
<hr>
<p><span>5 - 10 Videos</span><br>$150</p>
<hr>
<p><span>Edited Video</span><br>Additional $50</p>
</div>
<div class="largeTile" id="combo">
<h2 id="comboHeader">Combo<br>Plan</h2>
<hr class="topHR">
<p><span>Combined price of both plans</span><br>$50 Reduced</p>
<hr>
</div>
</div>
I noticed that the combo package text is at the bottom of the page instead of in the div where I placed it. Additionally, is it possible to change the order of the divs so that the combo package is last on the responsive site only? Thanks for your help in advance!
I noticed you did not specify the float value for the combo div. Add float to the combo styles as such:
#combo{
margin-right: 8.75%;
position: absolute;
left: 50%;
top: 60%;
transform: translate(-50%, -60%);
float: left;
}
In my project I have a problem. In the last area of the site I have a text written "Example" and an image on the side, but for some reason the image is below the text. I wanted to do the same thing as the top div, but invert the text on the left and the image on the right, does anyone know how I put the text up?
Code:
#import url('https://fonts.googleapis.com/css?family=Manjari&display=swap');
*{
margin: 0;
padding: 0;
outline: 0;
box-sizing: border-box;
}
html, body, #root, .render{
height: 100%;
}
body {
background: #111;
font-family: 'Manjari', sans-serif;
}
.mainBanner {
background: url('https://i.ibb.co/7XY9yyb/fundo.jpg');
height: 100%;
width: 100%;
}
.variacao {
height: 12%;
background-image: linear-gradient(to bottom, transparent 0%, #111 100%);
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.wall {
background: rgba(0, 0, 0, 0.5);
height: 100%;
overflow: auto;
width: 100%;
}
.topContainer {
margin-top: 15px;
}
.topContainer h1 {
font-size: 35px;
text-align: center;
color: #e50914;
}
.wellcomemsg {
text-align: center;
margin-top: 8%;
font-size: 5vw;
text-shadow: 1px 2px 3px rgba(255, 255, 255, 0.6);
color: #FFF;
}
.btns button {
margin: 0 auto;
padding: 15px 20px;
margin-top: 5px;
cursor: pointer;
border-radius: 3px;
margin-left: 10px;
border: 1px solid #e50914;
background: #e50914;
color: #FFF;
font-size: 22px;
}
.multi {
position: relative;
}
.multi p {
color: #FFF;
font-size: 2vw;
word-wrap: break-word;
float: right;
margin-right: 70px;
margin-top: 12%;
}
.multi img {
margin-bottom: 5%;
opacity: 0.95;
margin-left: 60px;
width: 30%;
margin-top: 4%;
cursor: pointer;
}
.multi img:hover {
opacity: 1;
}
.down {
position: relative;
}
.down p {
color: #FFF;
font-size: 2vw;
word-wrap: break-word;
margin-left: 70px;
margin-top: 12%;
}
.down img {
margin-bottom: 5%;
opacity: 0.95;
margin-right: 60px;
width: 30%;
float: right;
margin-top: 0%;
cursor: pointer;
}
.down img:hover {
opacity: 1;
}
hr {
border-color: #ccc;
width: 90%;
margin: 0 auto;
}
#media only screen and (max-width: 600px) {
.wellcomemsg {
font-size: 30px;
margin-top: 8vh;
}
.btns button {
margin-top: 20px;
font-size: 20px;
}
.multi img {
margin-top: 30px;
width: 90%;
margin-left: 5%;
}
.multi p {
width: 100%;
margin-top: 8%;
margin-right: 0;
text-align: center;
font-size: 20px;
}
}
<div class="render">
<div class="mainBanner">
<div class="wall">
<div class="topContainer">
<h1>IMM | YouWatch</h1>
</div>
<div class="wellcomemsg">
<p>Bem-vindo a YouWatch</p>
<p>Cria uma conta gratis ou experimenta</p>
<p>Uma conta paga durante 1 Mês</p>
<div class="btns">
<button>Criar uma conta</button>
<button>Iniciar Sessão</button>
</div>
</div>
<div class="variacao"></div>
</div>
</div>
<div class="multi">
<img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/>
<p>Veja os seus filmes e series favoritos onde e quando quiser!</p>
</div>
<hr />
<div class="down">
<p>Example</p>
<img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/>
</div>
<hr />
<p>T</p>
</div>
The image is underneath the 'Example' line in your code, surely this is why?
<div class="down">
<p>Example</p>
<img src="https://i.ibb.co/q9s3R9v/multi.png" alt="Multi Plataformas" title="Multi Plataformas"/>
</div>
You can use the below css:
.down p {
display: inline-block;
}
just such a problem – my contact page has a view bug when in the mobile view – the footer is aroused almost all over the screen and the contact form is on itsee screenshot, I marked the div that obviously causes problems . Checked all the HTML tags – they're OK, tried position of the objects in the CSS – nothing helps. In the desktop view everything looks OKsee screenshot. Here is the HTML document and a CSS file linked there. They are better to copy to an editor to run in a browser.
a {
color: #f91111;
}
a:hover {
color: #fff;
background: #f91111;
text-decoration: none;
}
body {
margin: 0;
padding: 0;
font-size: 97%;
line-height: 1.4em;
min-width: 500px;
font-family: Helvetica;
letter-spacing: 101%;
min-height: 100%;
}
header {
margin-bottom: 1%;
background-image: url(../images/DSC00075.JPG);
background-position: 0% 7%;
background-size: 100%;
background-opacity: 0.9;
background-color: #f91111;
padding: 1% 0 0%;
position: fixed;
z-index: 10;
width: 100%;
}
.header {
max-width: 1310px;
margin: 0 auto;
}
.collapse {
display: none;
}
.panel-group .panel-heading+.panel-collapse>.panel-body,
.panel-group .panel-heading+.panel-collapse>.list-group {
border-top: 1px solid #ddd;
}
main {
margin: 0 auto;
/* padding: 10% 15% 2.9%; */
font-size: 94%;
max-width: 1310px;
padding-top: 200px !important;
min-height: calc(74.75vh);
}
nav {
max-width: 750px;
text-align: left;
padding-bottom: 0.85em;
padding-left: 0.35em;
}
nav a {
display: inline;
text-align: left;
text-decoration: none;
padding: 2%;
margin-right: 4.8%;
border-radius: 5px;
color: #fff;
line-height: 1em;
}
nav a:hover {
background-color: #fff;
color: #000;
}
a.active {
background-color: #fff;
color: #000;
}
.footer {
font-size: 0.75rem;
padding: 1.5% 15% 1.25% 14.4%;
color: #fff;
}
h1 {
font-size: 4rem;
padding-bottom: 1rem;
padding-left: 0.8%;
color: #fff;
}
h2 {
font-size: 2.5em;
color: #f91111;
margin-bottom: 2.5rem;
line-height: 1.25em;
}
h3 {
font-size: 1.3em;
color: #f91111;
padding: 0.25% 0%;
}
h3.lebenslauf {
background: #f91111;
color: #fff;
padding: 0.25% 0% 0.25% 1%;
}
.hr4 .lightborder {
display: block;
width: 93%;
border-bottom: 1px solid #e8e8e8;
position: relative;
z-index: 1;
}
span.ul-second-line {
/*padding-left: 10px;*/
margin-left: 7px;
}
ul.Lebenslauf {
padding-left: 16px;
margin-top: 0px;
}
p.no-margin-before {
-webkit-margin-before: 0;
}
div.button {
display: inline;
font-size: 0.75rem;
padding: 5px;
margin-right: 10px;
min-width: 15%;
}
div.table-row {
max-width: 100%;
display: block;
margin-bottom: 0.75rem;
padding-left: 1px;
font-size: 0.95em;
}
div.left {
float: left;
width: 20%;
min-width: 150px;
display: inline;
}
div.right {
width: 75%;
display: inline-block;
}
.empty-bottom {
height: auto;
}
a.up-there {
text-decoration: none;
padding: 3px 5px;
}
div.kategorie a.up-there {
margin-right: -9px;
}
div.kategorie a.up-there:hover {
margin-right: 0px;
}
.collapse {
display: none;
}
strong.red-accentuation {
color: #f91111;
}
footer {
max-width: 100%;
background-color: #f91111;
padding: 0 2%;
vertical-align: bottom;
}
footer a {
color: white;
text-decoration: none;
margin-bottom: 0;
}
footer a:hover {
text-decoration: underline;
}
#image {
text-align: center;
width: auto;
border: none;
margin: 0 auto;
margin-bottom: 10px;
background-color: none;
font-size: 100%;
background-image: url('');
}
.empty-space {
text-align: right;
}
#image-alternative {
text-align: center;
margin: 0 auto;
margin-bottom: 10px;
}
.preview {
width: 10%;
margin-left: 10px;
border: 3px solid #f91111;
border-radius: 5px;
height: 15%;
}
.container {
max-width: 95%;
margin: 3% auto;
margin-left: 0;
padding: 10px;
padding-left: 0;
background-color: none;
overflow: hidden;
box-shadow: none;
}
.gallery ul {
list-style: none;
padding: 0;
margin: 0 auto;
}
.gallery li {
display: inline;
width: 50%;
height: 30vh;
margin: 2%;
margin-left: 0;
position: relative;
font-size: 0;
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.fade.in {
opacity: 1;
}
.fade {
opacity: 0;
-webkit-transition: opacity .15s linear;
-o-transition: opacity .15s linear;
transition: opacity .15s linear;
}
.referenz-link {
border: solid 1px #f91111;
border-radius: 10px;
width: 200px;
height: 200px;
margin-right: 30px;
margin-bottom: 30px;
overflow: hidden;
display: inline-block;
background: #f91111;
}
.referenz-link:last-child {
margin-right: 0px;
}
.referenz-link:hover {
background: none;
}
.picture-keeper {
overflow: hidden;
height: 133px;
margin-bottom: 10px;
border-bottom: solid 1px #f91111;
background: #fff;
}
img.reference {
width: 100%;
}
.notation {
padding: 0px 10px 15px;
text-align: center;
}
.referenz-link a {
color: #fff;
text-decoration: none;
font-weight: 700;
}
.referenz-link a:hover {
color: #f91111;
background: #fff;
}
h1.header {
display: inline-block;
}
img.presentation {
display: block;
margin-left: -1em;
}
h2.with-picture {
display: inline-block;
}
.foto-presentation {
text-align: center;
margin-bottom: 2.5em;
}
.adress-left {
display: inline-block;
float: left;
width: 48%;
margin-right: 2%;
}
.form-right {
display: inline-block;
width: 48%;
float: right;
}
dd,
dt {
display: inline-block;
}
dd {
margin-left: 0;
}
dt {
width: 7em;
}
dl {
-webkit-margin-before: 0;
-webkit-margin-after: 0;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
address {
font-style: normal;
}
label.kontaktangabe {
width: 8em;
display: inline-block;
}
textarea,
input[type="text"] {
border: solid 1px #f91111;
border-radius: 3px;
padding: 4px;
line-height: 1.5em !important;
}
textarea {
font: 400 0.95em Arial;
}
div#nachricht label {
vertical-align: top;
}
button.buttons {
color: #fff;
background: #f91111;
border: none;
border-radius: 3px;
font-size: 14px;
padding: 7px;
}
button.buttons:hover {
background: #a60c0c;
}
#kontaktdaten div.table-row {
font-size: 1em;
}
#kontaktdaten form {
padding-top: 1em;
}
#media screen and (min-width: 500px) and (max-width: 790px) {
header {
background-position: 0% 10%;
background-size: 100%;
padding: 1% 1% 1%;
margin: 0;
}
h1 {
font-size: 3rem;
}
nav a {
padding: 1.5%;
margin-right: 1%;
border-radius: 2px;
}
nav {
align: left;
padding-bottom: 0.1rem;
}
main {
margin: 0% 1%;
padding: 1%;
}
div.left {
margin-right: 1rem;
min-width: none;
}
.referenz-link {
width: 200px;
height: 200px;
margin-right: 45px;
margin-bottom: 45px;
}
.referenz-link:last-child {
margin-right: 0px;
}
.picture-keeper {
height: 133px;
}
.notation {
font-size: 1em;
}
.adress-left {
display: block;
width: 95%;
margin-bottom: 2em;
}
.form-right {
display: block;
width: 95%;
float: left;
}
label.kontaktangabe {
display: block;
}
}
#media screen and (max-width: 480px) {
body {
max-width: 450px;
font-size: 0.9rem;
padding: 0%;
}
header {
padding: 0% 1% 1%;
margin: 0;
background-position: 0% 0%;
background-repeat: no-repeat;
background-size: cover;
}
h1 {
font-size: 2rem;
}
nav {
max-width: 480px;
align: left;
padding-bottom: 0.6em;
}
nav a {
display: block;
text-align: left;
text-decoration: none;
padding: 1.5%;
margin: 0.5% 0%;
border-radius: 2px;
max-width: 30%;
}
main {
margin: 0% 0% 0% 1;
padding: 1% 0% 1% 1%;
max-width: 450px;
font-size: 100%;
}
div.left {
width: 100%;
float: none;
display: block;
min-width: 0;
}
div.right {
max-width: 100%;
display: block;
}
.hr4 .lightborder {
display: block;
max-width: 100%;
}
div.button {
display: block;
max-width: 50%;
text-align: center;
margin: 0 auto;
}
footer {
max-width: 480px !important;
}
.container {
padding: 0%;
}
img.preview {
margin-left: 0%;
margin-right: 2%;
}
.footer {
padding: 1.5% 0%;
max-width: 450px;
}
.referenz-link {
margin-right: 45px;
margin-bottom: 45px;
}
.notation {
font-size: 1.25em;
}
.adress-left {
display: block;
width: 95%;
margin-bottom: 2em;
}
.form-right {
display: block;
width: 95%;
float: left;
}
label.kontaktangabe {
display: block;
}
textarea.contact-form {
width: 379px;
}
dd,
dt {
display: block;
}
dd {
margin-bottom: 1em;
}
span.left {
font-weight: 700;
}
.kategorie .table-row {
margin-bottom: 2rem;
}
div#werdegang .table-row {
margin-bottom: 1em;
}
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Peter Schachnowskij – Homepage</title>
<link rel="stylesheet" href="css/portfolio.css">
</head>
<body>
<header>
<div class="header">
<h1>Peter Schachnowskij</h1>
<nav>
Startseite
Lebenslauf
Referenzen
Zeugnisse
<a class="active">Kontakt</a>
</nav>
</div>
</header>
<main>
<p> </p>
<h2>Kontakt</h2>
<div class="table-row" id="kontaktdaten">
<div class="adress-left">
<h3>Peter Schachnowskij</h3>
<p><address>Richterstraße 9<br>
70567 Stuttgart</address></p>
<p>
<dl><dt>Tel.:</dt>
<dd>01 76 / 21 75 17 11</dd>
</dl>
<dt>E-Mail: </dt>
<dd>peter.schachnowskij.gf#gmail.com</dd>
<p>
<p>
<dl><dt>Homepage:</dt>
<dd>noch im Aufbau</dd>
</dl>
<dl><dt>XING-Profil:</dt>
<dd>https://www.xing.com/profile/Peter_Schachnowskij</dd>
</dl>
</p>
</div>
<div class="form-right">
<h3>Haben Sie ein Anliegen?</h3>
<p>Schreiben Sie mir gerne!</p>
<form action="mailto:peter.schachnowskij.gf#gmail.com" method="post">
<div class="table-row"><label class="kontaktangabe" for="name">Ihr Name*: </label><input type="text" value size="50" aria-required="true" aria-invalid="false" /></div>
<div class="table-row"><label class="kontaktangabe" for="vorname">Ihr Vorname*: </label><input type="text" value size="50" aria-required="true" aria-invalid="false" /></div>
<div class="table-row"><label class="kontaktangabe" for="e-mail">Ihre E-Mail*: </label><input type="text" value size="50" aria-required="true" aria-invalid="false" /></div>
<div class="table-row"><label class="kontaktangabe" for="telefon">Ihr Telefon: </label><input type="text" value size="50" aria-required="false" aria-invalid="false" /></div>
<div class="table-row" id="nachricht"><label class="kontaktangabe" for="nachricht">Ihre Nachricht: </label><textarea name="your-message" cols="52" rows="12" class="contact-form" aria-invalid="false"></textarea></div>
<div class="table-row"><label class="kontaktangabe" for="absenden"> </label><button class="buttons" type="submit" name="action" id="absenden">Absenden</button></div>
</form>
<div class="empty-bottom"> </div>
</div>
</div>
</main>
<div class="empty-bottom"> </div>
<footer>
<div class="footer">
<div class="button">Peter Schachnowskij </div>
<div class="button">Richterstr. 9 </div>
<div class="button">70567 Stuttgart </div>
<div class="button">
<nobr>Tel.: 01 76 / 21 75 17 11</nobr>
</div>
<div class="button">
<nobr>E-Mail: peter.schachnowskij.gf#gmail.com</nobr>
</div>
</div>
</footer>
</body>
</html>
Can someone please help me? Thanx in previous.
Ever since I added "position absoulte" to my div ".container" in my code below, my CSS animate code zooms in from the bottom then hiccups and positions itself to the center.
How can I make my animate zoom just zoom in right to the center without this hiccup where it goes down first then a second later it automatically moves to the center?
If I remove the position absolute from the .container div the animate zoom works just fine but it's not centered anymore vertically (just horizontally). The reason I used position absolute and left 0 and right 0 was to center it both ways.
Here is my code:
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0 auto;
color: white;
text-align: center;
font-family: 'Lato', serif;
background: linear-gradient(white 70px, #007580 70px);
-webkit-text-size-adjust: none;
}
header,
footer {
background: #007580
}
body,
main {
display: flex;
flex: 1;
}
body {
flex-flow: column;
}
header {
min-height: 35px;
}
footer {
min-height: 35px;
}
section {
margin: auto;
width: 95%;
height: 100%;
color: black;
background-color: white;
}
.categories {
position: relative;
top: 3px;
color: white;
font-size: 16px;
font-weight: 300;
word-spacing: 26px;
padding-bottom: 2px;
}
.categories a {
text-decoration: none;
color: inherit;
}
.legal {
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
font-weight: 300;
word-spacing: 15px;
}
.legal a {
text-decoration: none;
font-size: 14px;
color: white;
}
.quote {
position: relative;
margin: auto;
font-size: 20px;
font-weight: 300;
bottom: 80px;
height: 0;
}
.searchcontainer {
position: relative;
height: 0;
bottom: 43px;
margin: auto;
width: 380px;
;
}
input[type=text] {
width: 100%;
display: inline-block;
border: 2px solid #ddd;
border-radius: 4px;
padding: 6px 0 7px 40px;
background-image: url('https://image.ibb.co/j9esac/searchicon.png');
background-position: 10px 6px;
background-repeat: no-repeat;
font-size: 16px;
background-color: white;
}
.innercircle {
height: 89px;
width: 89px;
border-radius: 50%;
background-color: white;
margin: auto;
position: relative;
bottom: 93px;
}
.outercircle {
height: 120px;
width: 120px;
border-radius: 50%;
background-color: #007580;
margin: auto;
position: relative;
top: 11px;
}
.D {
font-size: 100px;
font-weight: 100;
position: relative;
bottom: 196px;
right: 3px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.D a {
text-decoration: none;
color: inherit;
}
.R {
font-size: 55px;
font-weight: 100;
position: relative;
bottom: 173px;
right: 2px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.R a {
text-decoration: none;
color: inherit;
}
.ICONwhatsnew {
position: relative;
margin: auto;
bottom: 194px;
right: 191px;
width: 0;
display: block;
height: 0;
}
.ICONwhatsnew a {
text-decoration: none;
color: inherit;
}
.ICONworldlanguages {
position: relative;
margin: auto;
bottom: 190px;
right: 116px;
width: 0;
display: block;
height: 0;
}
.ICONworldlanguages a {
text-decoration: none;
color: inherit;
}
.ICONsignin {
position: relative;
margin: auto;
bottom: 192px;
left: 83px;
width: 0;
display: block;
height: 0;
}
.ICONsignin a {
text-decoration: none;
color: inherit;
}
.ICONcart {
position: relative;
margin: auto;
bottom: 192px;
left: 149px;
width: 0;
display: block;
height: 0;
}
.ICONcart a {
text-decoration: none;
color: inherit;
}
.container {
font-size: 17px;
font-weight: 400;
color: #007580;
top: 50%;
left: 0;
right: 0;
position: absolute;
}
input[type=unams] {
width: 80%;
padding: 12px 45px;
margin: 22px 0 0 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/fZHHnc/signin.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
input[type=password] {
width: 80%;
padding: 12px 45px;
/* first is how big you want the input box 2nd is positioning of word password */
margin: 22px 0 15px 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/jC7gfx/lock.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
.buttonlg {
background-color: #007580;
border: none;
color: white;
width: 25%;
font-size: 17px;
height: 38px;
margin: auto;
text-align: center;
}
.outerform {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.innerform {
width: 90%;
height: 90%;
}
.box {
background-color: white;
border: 1px solid #007580;
height: 100%;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
#-webkit-keyframes animatezoom {
from {
-webkit-transform: scale(0)
}
to {
-webkit-transform: scale(1)
}
}
::-webkit-input-placeholder {
/* WebKit browsers */
color: lightgrey;
opacity: 1 !important;
}
.circlelogo1 {
background: #007580;
border-radius: 50%;
height: 30px;
width: 30px;
position: relative;
margin: auto;
/*
Child elements with absolute positioning will be
positioned relative to this div
*/
}
.circlelogo2 {
position: absolute;
background: white;
border-radius: 50%;
height: 18px;
width: 18px;
/*
Put top edge and left edge in the center
*/
top: 50%;
left: 50%;
margin: -9px 0px 0px -9px;
/*
Offset the position correctly with
minus half of the width and minus half of the height
*/
}
<div class="outercircle"></div>
<div class="innercircle"></div>
<div class="D">
D
</div>
<div class="R">
R
</div>
<div class="quote">
You will always be your greatest investment.
</div>
<div class="searchcontainer">
<form>
<input name="search" placeholder="Search all resources..." type="text">
</form>
</div>
<div class="ICONsignin">
<img height="37px" src="https://svgshare.com/i/5SR.svg">
</div>
<div class="ICONcart">
<img height="39px" src="https://svgshare.com/i/5SE.svg">
</div>
<div class="ICONworldlanguages">
<img height="34px" src="https://svgshare.com/i/5XW.svg">
</div>
<div class="ICONwhatsnew">
<img height="43px" src="https://svgshare.com/i/5aX.svg">
</div>
<header>
<div class="categories">
<b>Categories</b> Newest Popular Music Youth
</div>
</header>
<main>
<section>
<div class="outerform">
<div class="innerform">
<form class="animate box">
<div class="container">
<div class="circlelogo1">
<div class="circlelogo2">
</div>
</div>
<input type="unams" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required><br>
<button class="buttonlg" type="submit">Log In</button>
</div>
</form>
</div>
</div>
</section>
</main>
<footer>
<div class="legal">
Contact Privacy Terms Copyright About
</div>
</footer>
You are using position:absolute and the parent element is not set with relative so the form is not relative to the scaled container which is creating this issue. You need to set position:relative to the parent container and then adjust the centering:
.box {
...
position:relative; /*Added this*/
}
.container {
...
transform:translate(0,-50%); /*Added this*/
top: 50%;
...
}
Here is the full code:
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0 auto;
color: white;
text-align: center;
font-family: 'Lato', serif;
background: linear-gradient(white 70px, #007580 70px);
-webkit-text-size-adjust: none;
}
header,
footer {
background: #007580
}
body,
main {
display: flex;
flex: 1;
}
body {
flex-flow: column;
}
header {
min-height: 35px;
}
footer {
min-height: 35px;
}
section {
margin: auto;
width: 95%;
height: 100%;
color: black;
background-color: white;
}
.categories {
position: relative;
top: 3px;
color: white;
font-size: 16px;
font-weight: 300;
word-spacing: 26px;
padding-bottom: 2px;
}
.categories a {
text-decoration: none;
color: inherit;
}
.legal {
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
font-weight: 300;
word-spacing: 15px;
}
.legal a {
text-decoration: none;
font-size: 14px;
color: white;
}
.quote {
position: relative;
margin: auto;
font-size: 20px;
font-weight: 300;
bottom: 80px;
height: 0;
}
.searchcontainer {
position: relative;
height: 0;
bottom: 43px;
margin: auto;
width: 380px;
;
}
input[type=text] {
width: 100%;
display: inline-block;
border: 2px solid #ddd;
border-radius: 4px;
padding: 6px 0 7px 40px;
background-image: url('https://image.ibb.co/j9esac/searchicon.png');
background-position: 10px 6px;
background-repeat: no-repeat;
font-size: 16px;
background-color: white;
}
.innercircle {
height: 89px;
width: 89px;
border-radius: 50%;
background-color: white;
margin: auto;
position: relative;
bottom: 93px;
}
.outercircle {
height: 120px;
width: 120px;
border-radius: 50%;
background-color: #007580;
margin: auto;
position: relative;
top: 11px;
}
.D {
font-size: 100px;
font-weight: 100;
position: relative;
bottom: 196px;
right: 3px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.D a {
text-decoration: none;
color: inherit;
}
.R {
font-size: 55px;
font-weight: 100;
position: relative;
bottom: 173px;
right: 2px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.R a {
text-decoration: none;
color: inherit;
}
.ICONwhatsnew {
position: relative;
margin: auto;
bottom: 194px;
right: 191px;
width: 0;
display: block;
height: 0;
}
.ICONwhatsnew a {
text-decoration: none;
color: inherit;
}
.ICONworldlanguages {
position: relative;
margin: auto;
bottom: 190px;
right: 116px;
width: 0;
display: block;
height: 0;
}
.ICONworldlanguages a {
text-decoration: none;
color: inherit;
}
.ICONsignin {
position: relative;
margin: auto;
bottom: 192px;
left: 83px;
width: 0;
display: block;
height: 0;
}
.ICONsignin a {
text-decoration: none;
color: inherit;
}
.ICONcart {
position: relative;
margin: auto;
bottom: 192px;
left: 149px;
width: 0;
display: block;
height: 0;
}
.ICONcart a {
text-decoration: none;
color: inherit;
}
.container {
font-size: 17px;
font-weight: 400;
color: #007580;
transform:translate(0,-50%);
top: 50%;
left: 0;
right: 0;
position: absolute;
}
input[type=unams] {
width: 80%;
padding: 12px 45px;
margin: 22px 0 0 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/fZHHnc/signin.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
input[type=password] {
width: 80%;
padding: 12px 45px;
/* first is how big you want the input box 2nd is positioning of word password */
margin: 22px 0 15px 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/jC7gfx/lock.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
.buttonlg {
background-color: #007580;
border: none;
color: white;
width: 25%;
font-size: 17px;
height: 38px;
margin: auto;
text-align: center;
}
.outerform {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.innerform {
width: 90%;
height: 90%;
}
.box {
background-color: white;
border: 1px solid #007580;
height: 100%;
position:relative;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
#-webkit-keyframes animatezoom {
from {
-webkit-transform: scale(0)
}
to {
-webkit-transform: scale(1)
}
}
::-webkit-input-placeholder {
/* WebKit browsers */
color: lightgrey;
opacity: 1 !important;
}
.circlelogo1 {
background: #007580;
border-radius: 50%;
height: 30px;
width: 30px;
position: relative;
margin: auto;
/*
Child elements with absolute positioning will be
positioned relative to this div
*/
}
.circlelogo2 {
position: absolute;
background: white;
border-radius: 50%;
height: 18px;
width: 18px;
/*
Put top edge and left edge in the center
*/
top: 50%;
left: 50%;
margin: -9px 0px 0px -9px;
/*
Offset the position correctly with
minus half of the width and minus half of the height
*/
}
<div class="outercircle"></div>
<div class="innercircle"></div>
<div class="D">
D
</div>
<div class="R">
R
</div>
<div class="quote">
You will always be your greatest investment.
</div>
<div class="searchcontainer">
<form>
<input name="search" placeholder="Search all resources..." type="text">
</form>
</div>
<div class="ICONsignin">
<img height="37px" src="https://svgshare.com/i/5SR.svg">
</div>
<div class="ICONcart">
<img height="39px" src="https://svgshare.com/i/5SE.svg">
</div>
<div class="ICONworldlanguages">
<img height="34px" src="https://svgshare.com/i/5XW.svg">
</div>
<div class="ICONwhatsnew">
<img height="43px" src="https://svgshare.com/i/5aX.svg">
</div>
<header>
<div class="categories">
<b>Categories</b> Newest Popular Music Youth
</div>
</header>
<main>
<section>
<div class="outerform">
<div class="innerform">
<form class="animate box">
<div class="container">
<div class="circlelogo1">
<div class="circlelogo2">
</div>
</div>
<input type="unams" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required><br>
<button class="buttonlg" type="submit">Log In</button>
</div>
</form>
</div>
</div>
</section>
</main>
<footer>
<div class="legal">
Contact Privacy Terms Copyright About
</div>
</footer>
By the way it's better to consider another way than positioned element to center. You can do it with flex since you are already using it:
.box {
....
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
Then remove everything related to positionning from .container.
Here is the full code:
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0 auto;
color: white;
text-align: center;
font-family: 'Lato', serif;
background: linear-gradient(white 70px, #007580 70px);
-webkit-text-size-adjust: none;
}
header,
footer {
background: #007580
}
body,
main {
display: flex;
flex: 1;
}
body {
flex-flow: column;
}
header {
min-height: 35px;
}
footer {
min-height: 35px;
}
section {
margin: auto;
width: 95%;
height: 100%;
color: black;
background-color: white;
}
.categories {
position: relative;
top: 3px;
color: white;
font-size: 16px;
font-weight: 300;
word-spacing: 26px;
padding-bottom: 2px;
}
.categories a {
text-decoration: none;
color: inherit;
}
.legal {
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
font-weight: 300;
word-spacing: 15px;
}
.legal a {
text-decoration: none;
font-size: 14px;
color: white;
}
.quote {
position: relative;
margin: auto;
font-size: 20px;
font-weight: 300;
bottom: 80px;
height: 0;
}
.searchcontainer {
position: relative;
height: 0;
bottom: 43px;
margin: auto;
width: 380px;
;
}
input[type=text] {
width: 100%;
display: inline-block;
border: 2px solid #ddd;
border-radius: 4px;
padding: 6px 0 7px 40px;
background-image: url('https://image.ibb.co/j9esac/searchicon.png');
background-position: 10px 6px;
background-repeat: no-repeat;
font-size: 16px;
background-color: white;
}
.innercircle {
height: 89px;
width: 89px;
border-radius: 50%;
background-color: white;
margin: auto;
position: relative;
bottom: 93px;
}
.outercircle {
height: 120px;
width: 120px;
border-radius: 50%;
background-color: #007580;
margin: auto;
position: relative;
top: 11px;
}
.D {
font-size: 100px;
font-weight: 100;
position: relative;
bottom: 196px;
right: 3px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.D a {
text-decoration: none;
color: inherit;
}
.R {
font-size: 55px;
font-weight: 100;
position: relative;
bottom: 173px;
right: 2px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.R a {
text-decoration: none;
color: inherit;
}
.ICONwhatsnew {
position: relative;
margin: auto;
bottom: 194px;
right: 191px;
width: 0;
display: block;
height: 0;
}
.ICONwhatsnew a {
text-decoration: none;
color: inherit;
}
.ICONworldlanguages {
position: relative;
margin: auto;
bottom: 190px;
right: 116px;
width: 0;
display: block;
height: 0;
}
.ICONworldlanguages a {
text-decoration: none;
color: inherit;
}
.ICONsignin {
position: relative;
margin: auto;
bottom: 192px;
left: 83px;
width: 0;
display: block;
height: 0;
}
.ICONsignin a {
text-decoration: none;
color: inherit;
}
.ICONcart {
position: relative;
margin: auto;
bottom: 192px;
left: 149px;
width: 0;
display: block;
height: 0;
}
.ICONcart a {
text-decoration: none;
color: inherit;
}
.container {
font-size: 17px;
font-weight: 400;
color: #007580;
}
input[type=unams] {
width: 80%;
padding: 12px 45px;
margin: 22px 0 0 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/fZHHnc/signin.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
input[type=password] {
width: 80%;
padding: 12px 45px;
/* first is how big you want the input box 2nd is positioning of word password */
margin: 22px 0 15px 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/jC7gfx/lock.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
.buttonlg {
background-color: #007580;
border: none;
color: white;
width: 25%;
font-size: 17px;
height: 38px;
margin: auto;
text-align: center;
}
.outerform {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.innerform {
width: 90%;
height: 90%;
}
.box {
background-color: white;
border: 1px solid #007580;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
#-webkit-keyframes animatezoom {
from {
-webkit-transform: scale(0)
}
to {
-webkit-transform: scale(1)
}
}
::-webkit-input-placeholder {
/* WebKit browsers */
color: lightgrey;
opacity: 1 !important;
}
.circlelogo1 {
background: #007580;
border-radius: 50%;
height: 30px;
width: 30px;
position: relative;
margin: auto;
/*
Child elements with absolute positioning will be
positioned relative to this div
*/
}
.circlelogo2 {
position: absolute;
background: white;
border-radius: 50%;
height: 18px;
width: 18px;
/*
Put top edge and left edge in the center
*/
top: 50%;
left: 50%;
margin: -9px 0px 0px -9px;
/*
Offset the position correctly with
minus half of the width and minus half of the height
*/
}
<div class="outercircle"></div>
<div class="innercircle"></div>
<div class="D">
D
</div>
<div class="R">
R
</div>
<div class="quote">
You will always be your greatest investment.
</div>
<div class="searchcontainer">
<form>
<input name="search" placeholder="Search all resources..." type="text">
</form>
</div>
<div class="ICONsignin">
<img height="37px" src="https://svgshare.com/i/5SR.svg">
</div>
<div class="ICONcart">
<img height="39px" src="https://svgshare.com/i/5SE.svg">
</div>
<div class="ICONworldlanguages">
<img height="34px" src="https://svgshare.com/i/5XW.svg">
</div>
<div class="ICONwhatsnew">
<img height="43px" src="https://svgshare.com/i/5aX.svg">
</div>
<header>
<div class="categories">
<b>Categories</b> Newest Popular Music Youth
</div>
</header>
<main>
<section>
<div class="outerform">
<div class="innerform">
<form class="animate box">
<div class="container">
<div class="circlelogo1">
<div class="circlelogo2">
</div>
</div>
<input type="unams" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required><br>
<button class="buttonlg" type="submit">Log In</button>
</div>
</form>
</div>
</div>
</section>
</main>
<footer>
<div class="legal">
Contact Privacy Terms Copyright About
</div>
</footer>
There's a few issues. In your .box styling you should add position: relative; this will force .container's absolute positioning to respect its parent, in this case .box's positioning and size. The second is the top: 50%; on .container. In certain scenarios that can seem to center the item but in others it does not. What you can do to center .container within .box is add transform: translate(0, -50%); which offsets top: 50% and centers the element. Same can be done horizontally with left: 50% and transform: translate(-50%, -50%);.
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0 auto;
color: white;
text-align: center;
font-family: 'Lato', serif;
background: linear-gradient(white 70px, #007580 70px);
-webkit-text-size-adjust: none;
}
header,
footer {
background: #007580
}
body,
main {
display: flex;
flex: 1;
}
body {
flex-flow: column;
}
header {
min-height: 35px;
}
footer {
min-height: 35px;
}
section {
margin: auto;
width: 95%;
height: 100%;
color: black;
background-color: white;
}
.categories {
position: relative;
top: 3px;
color: white;
font-size: 16px;
font-weight: 300;
word-spacing: 26px;
padding-bottom: 2px;
}
.categories a {
text-decoration: none;
color: inherit;
}
.legal {
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
font-weight: 300;
word-spacing: 15px;
}
.legal a {
text-decoration: none;
font-size: 14px;
color: white;
}
.quote {
position: relative;
margin: auto;
font-size: 20px;
font-weight: 300;
bottom: 80px;
height: 0;
}
.searchcontainer {
position: relative;
height: 0;
bottom: 43px;
margin: auto;
width: 380px;
;
}
input[type=text] {
width: 100%;
display: inline-block;
border: 2px solid #ddd;
border-radius: 4px;
padding: 6px 0 7px 40px;
background-image: url('https://image.ibb.co/j9esac/searchicon.png');
background-position: 10px 6px;
background-repeat: no-repeat;
font-size: 16px;
background-color: white;
}
.innercircle {
height: 89px;
width: 89px;
border-radius: 50%;
background-color: white;
margin: auto;
position: relative;
bottom: 93px;
}
.outercircle {
height: 120px;
width: 120px;
border-radius: 50%;
background-color: #007580;
margin: auto;
position: relative;
top: 11px;
}
.D {
font-size: 100px;
font-weight: 100;
position: relative;
bottom: 196px;
right: 3px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.D a {
text-decoration: none;
color: inherit;
}
.R {
font-size: 55px;
font-weight: 100;
position: relative;
bottom: 173px;
right: 2px;
margin: auto;
color: #007580;
height: 0;
font-family: 'Amiri', serif;
letter-spacing: -10px;
}
.R a {
text-decoration: none;
color: inherit;
}
.ICONwhatsnew {
position: relative;
margin: auto;
bottom: 194px;
right: 191px;
width: 0;
display: block;
height: 0;
}
.ICONwhatsnew a {
text-decoration: none;
color: inherit;
}
.ICONworldlanguages {
position: relative;
margin: auto;
bottom: 190px;
right: 116px;
width: 0;
display: block;
height: 0;
}
.ICONworldlanguages a {
text-decoration: none;
color: inherit;
}
.ICONsignin {
position: relative;
margin: auto;
bottom: 192px;
left: 83px;
width: 0;
display: block;
height: 0;
}
.ICONsignin a {
text-decoration: none;
color: inherit;
}
.ICONcart {
position: relative;
margin: auto;
bottom: 192px;
left: 149px;
width: 0;
display: block;
height: 0;
}
.ICONcart a {
text-decoration: none;
color: inherit;
}
.container {
font-size: 17px;
font-weight: 400;
color: #007580;
top: 50%;
left: 0;
right: 0;
position: absolute;
transform: translate(0, -50%);
}
input[type=unams] {
width: 80%;
padding: 12px 45px;
margin: 22px 0 0 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/fZHHnc/signin.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
input[type=password] {
width: 80%;
padding: 12px 45px;
/* first is how big you want the input box 2nd is positioning of word password */
margin: 22px 0 15px 0;
border: 1px solid #007580;
box-sizing: border-box;
border-radius: 0px;
-webkit-appearance: none;
font-size: 17px;
background-image: url('https://image.ibb.co/jC7gfx/lock.png');
background-position: 10px 8px;
background-repeat: no-repeat;
background-size: 25px;
}
.buttonlg {
background-color: #007580;
border: none;
color: white;
width: 25%;
font-size: 17px;
height: 38px;
margin: auto;
text-align: center;
}
.outerform {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.innerform {
width: 90%;
height: 90%;
}
.box {
position: relative;
background-color: white;
border: 1px solid #007580;
height: 100%;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
#-webkit-keyframes animatezoom {
from {
-webkit-transform: scale(0)
}
to {
-webkit-transform: scale(1)
}
}
::-webkit-input-placeholder {
/* WebKit browsers */
color: lightgrey;
opacity: 1 !important;
}
.circlelogo1 {
background: #007580;
border-radius: 50%;
height: 30px;
width: 30px;
position: relative;
margin: auto;
/*
Child elements with absolute positioning will be
positioned relative to this div
*/
}
.circlelogo2 {
position: absolute;
background: white;
border-radius: 50%;
height: 18px;
width: 18px;
/*
Put top edge and left edge in the center
*/
top: 50%;
left: 50%;
margin: -9px 0px 0px -9px;
/*
Offset the position correctly with
minus half of the width and minus half of the height
*/
}
<div class="outercircle"></div>
<div class="innercircle"></div>
<div class="D">
D
</div>
<div class="R">
R
</div>
<div class="quote">
You will always be your greatest investment.
</div>
<div class="searchcontainer">
<form>
<input name="search" placeholder="Search all resources..." type="text">
</form>
</div>
<div class="ICONsignin">
<img height="37px" src="https://svgshare.com/i/5SR.svg">
</div>
<div class="ICONcart">
<img height="39px" src="https://svgshare.com/i/5SE.svg">
</div>
<div class="ICONworldlanguages">
<img height="34px" src="https://svgshare.com/i/5XW.svg">
</div>
<div class="ICONwhatsnew">
<img height="43px" src="https://svgshare.com/i/5aX.svg">
</div>
<header>
<div class="categories">
<b>Categories</b> Newest Popular Music Youth
</div>
</header>
<main>
<section>
<div class="outerform">
<div class="innerform">
<form class="animate box">
<div class="container">
<div class="circlelogo1">
<div class="circlelogo2">
</div>
</div>
<input type="unams" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required><br>
<button class="buttonlg" type="submit">Log In</button>
</div>
</form>
</div>
</div>
</section>
</main>
<footer>
<div class="legal">
Contact Privacy Terms Copyright About
</div>
</footer>
I'm currently developing an application using iOS 10 and Swift 3
The purpose of this application is to make a PDF file with the content of my UIWebview
It doesn’t work and I have to delete theses lines to generate the PDF.
<div>
#Test#
</div>
Otherwise we have a trouble with in my IBAction :
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
The memory increase like if it was an infini loop
The pdf is not generated and I don't understand why.
Does somebody has an idea about this ?
And I don’t understand why ?
If someone has an idea ?
My swift IBAction :
if let contentOpt = self.contentFile {
let fmt = UIMarkupTextPrintFormatter(markupText: contentOpt)
let render = UIPrintPageRenderer()
render.addPrintFormatter(self.webView.viewPrintFormatter(), startingAtPageAt: 0)
let page = CGRect(x: 0, y: 0, width: 595.2, height: 841.8) // A4, 72 dpi
let printable = page.insetBy(dx: 0, dy: 0)
render.setValue(NSValue(cgRect: page), forKey: "paperRect")
render.setValue(NSValue(cgRect: printable), forKey: "printableRect")
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, nil)
print("Data ", pdfData)
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
UIGraphicsEndPDFContext();
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
print("PATH => \(documentsPath)")
pdfData.write(toFile: "\(documentsPath)/file.pdf", atomically: true)
}
This is my CSS code :
<style>
.footer {
page-break-after: always;
}
#media print {
body {
-webkit-print-color-adjust: exact !important;
font-size: small;
}
.pageBreak {
page-break-after: always;
color:red;
}
.headerPDF{
width:100%;
height:50px;
}
#containerImageFuelAndMileage{
text-align: center;
margin-top: 1pt;
}
}
.green, .yellow, .red {
z-index: 10;
position: absolute;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 30px;
height: 30px;
}
.green {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAApCAQAAAA/+6kbAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAAiIJ56tAAAB5klEQVRYw7XX3U7UQBTA8Vk2WVFU0CdgkV0QDfgoRlZDVl8HQ9SIIUYNEZU74o0xxk+MWVGEsMgzoC749QTuNvl70dW225memdKeuWja9OSXtjNnThUql1HkEZej1/KClgGPet6UDwF4zORJFXlIEB6X8qL6eEA0/mPZQgWWiIfHxawpPQTQoZYlVeA+5mgznR20SHKsZAXdE6AnlLKB7spQFt+qwB0BekpJNwOr4fVtBd0WoGc+1EtVaOFxxQFaEKDn/6AoNcq37pKrW0K3BOhFAIWpU13Ix+TX6AgFVBiyw+YF6CWHohn+YYSvsVtDNVkzbgrQK/p7cxSKMl+0t3fLpGbcEKDXHI5nKcrsGlM61DTQ9TQQStFITGsz3ZNyTYDecET/LhTDCU8F8IcLoYQ5AXprgpK/VRy7KkDvzFAwAyXsPIrZg0DButJN9yj2WIAayZCpWrjHewnS10D3WGNArpnR0wqtVNBRGdLtV67YBztItwtX2XOAPnLMDtJv+GPsW0LrHLeFTL3FON8toE8M2kPmNuY0PwRoww1K6pgm+JkAbbpCyc2ZGdtyh6Q+8Ay/NFAzDSS3nGdjWJOhNJBNdzsZwbbTQnaN9BS/u9BnTqSFbHt2H9vhZHrI/vfgHKsHg1B/AXlXUdOz+ocUAAAAAElFTkSuQmCC) #14c77c no-repeat center !important;
background-size: 20px 14px !important;
}
.yellow {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAA2CAQAAAArUtIRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAR384UsHAAAD80lEQVRYw7WYT2xURRzHv+xz1bRgu8VWQKmlAoJBQ1Ir5YIJQYPEqISDGKNGEyEhMbGamKgc9IInEvVgjEJFS5EYL+pBjCFiyQYoAokNLdADqcHEiHZZirWxsB8Pu52d9968t+816bzDvp3fbz7fmd/On9+sUIqnh7tS+Qulcx/lb7bMrgDAHubOrgCM8NDsCsAUO/FmUwCgn7trt5mDEpQmrdUqtel51fnqi9qhAzXa1uhBOzs5Q4no0sdtMw3ROr7jBrXLRRanF7iXbxKgAQpsTTuCDN1MJMQfoTXtLMpxyNnPQ3xIwVf3H2+SSTtNWzkXQF9mN2sqIHuanqcz/TpYwsUA/BXqnOvgE+rTr+RmRnz4PTQ6F9plnkq+OKuvWfIWfMI5N0aBH1mUHG8L7PL9pGuc7hd4jTlp8FWBLq4b/DgdEe5tMSiP9miBDCcNvsQT6fpYwfcw5upY+eM5Kzy7Z4TfVwlth0sgw5DBj3DLjPFliQfDApus/m+eAf5z3+S+4pcQ4ktjPJt2juDxRWhbOewXuJV/jGlbanxvCP8LOb/Aemvzmh9C5GLG5LE/hD8ZXP3iXWM8GkLcwRCfRkh49NXGI/G1Me8KGBdUZtdeh4THAQe+wbUOBo3DswH8sLHsDez7njUxpssJFx6Jv4zLOsuw0MID9FgSHgeT4tFNajQJxhUr2XhfK3zJx4uSXtYNSZ769HQgNTmujSpa329Wh+olSY2y8ob7LeX5nA718jM8PL4K1R8L9X5p1WiHaK3PqYlTIdQ+Bz7vCM5qYy3KOsWC24RLIgne3nwuZfSbidx9gciOaYNOxaaFeT3mi/10WW7eRjMaNF86Q44FPRIjkdcmXXVauszbsH0WFMk6httoHUZ2Ocq8iC0kwx/G6yWxyEptH3c2cElE4+3dDdqFrAn5bUSTBgZ8+P7YS1R1EzlbPg9eNRUlHoiUOJEQ38aU8Xy7LHA7k6bq+8iGDRwH4OcaOV11pUzROn3of2wN/5kYiWM18Y9apN7yZifEYv411WPcEyNRF4tv4XfDmWRpVUC8ZSkP0hyLiXrqKkEsl/eQLZDlV8s44Dg8az1zOWwRhqfHWnVYwVXL4TzLUuHv9PV+ktXTFttps5WfQpEXEuM38qfVsmSfjX7HbYEL60+RaXD1WR46nd+w7UH37b5RAPzAloh00mMDBwP+Jbr9XuGb/pPq1bxA3TX1K68LGtW4riunBVqpTq1XU8BvQtu1v/ZNf1nE/lmrnGNVmOaOa5bXGU8Fn+QddyCjf7yFfMC1hPCPoq/j8TMkxw7ysX+FnKGbljhGkr9zWvSwurRSS9SsemVVUEGXNKQBHbFO9IjyP6DLBdf+7yKKAAAAAElFTkSuQmCC) #ffaa01 no-repeat center !important;
background-size: 18px 20px !important;
}
.red {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAArCAQAAAAA/GqmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QCiEweu5LAAAAP0lEQVQoz2P8b8AgwoAMrjD83/IfFUQxMWCAUaFhK8TC8ILhHorIF8b/g8JdLQzmKCLtNE6rLAx3GM6iiLwDACVJK/z9gk6AAAAAAElFTkSuQmCC) #c3002f no-repeat center !important;
background-size: 4px 17px !important;
}
.grayBack {
background: #eeeeee !important;
}
.whiteBack {
background: #ffffff !important;
}
body {
position: absolute;
display: inline;
height: 100%;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
#date {
top: 0;
right: 30px;
position: absolute;
}
</style>
<style>
#header {
position: relative;
display: block;
height: 340px;
width: 100%;
}
#logoNissan {
position: absolute;
z-index: 10;
top: 0;
left: 43px;
width: 129px;
}
#title > span {
position: absolute;
left: 206px;
top: 53px;
font-size: 15px;
font-weight: bold;
color: #343434;
}
#date {
}
#date > div {
line-height: 12px;
}
#date > span:nth-of-type(1) {
}
#date > span:nth-of-type(2) {
margin-left: 30px;
}
#date > span {
display: inline-block;
}
#date > span:nth-of-type(-n+2) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#date > span:nth-of-type(n+3) {
font-size: 12px;
font-weight: normal;
color: #343434;
}
#gray {
position: absolute;
top: 120px;
height: 190px;
width: 100%;
background: #eeeeee !important;
}
#gray > div {
display: inline-block;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6) {
position: relative;
display: inline-block;
vertical-align: middle;
}
#gray > .green {
margin-left: 180px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(odd) {
margin-top: 40px;
}
#gray > div:nth-of-type(n+3):nth-of-type(-n+6):nth-of-type(odd) {
margin-left: 20px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(even) {
color: #343434;
font-size: 12px;
font-weight: bold;
margin-left: 20px;
margin-top: 35px;
}
#gray > #DealerLine {
left: 206px;
height: 150px;
font-weight: normal;
}
#gray > #DealerLine > span {
color: #343434;
font-size: 14px;
}
#gray > #DealerLine > span:nth-of-type(3) {
top: 10px;
position: relative;
}
#gray > #DealerLine > span:nth-of-type(even) {
margin-left: 20px;
font-weight: bold;
}
#gray > #DealerLine > span:nth-of-type(odd) {
font-weight: normal;
}
#gray > #DealerLine > div {
line-height: 10px;
}
</style>
<style>
.marginContainer{
margin-top: 6px;
}
#descriptionLineColor {
width: 951px;
}
#custDetail {
position: relative;
display: block;
width: 100%;
height: 305px;
margin-top: 25px;
}
#custTitle {
position: absolute;
left: 30px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#custInfos {
position: absolute;
top: 42px;
left: 30px;
line-height: 0px;
}
#vehicleTitle {
position: absolute;
top: 115px;
left: 30px;
line-height: 0px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#vehicleInfos {
position: absolute;
top: 140px;
left: 30px;
}
#vehicleDescription {
position: absolute;
right: 5%;
top: 42px;
width: 50vw;
text-align: center;
}
#custInfos > span {
position: relative;
color: #343434;
font-size: 14px;
text-align: left;
}
#custInfos > div {
line-height: 35px;
}
#custInfos > span:nth-of-type(odd) {
font-weight: normal;
}
#custInfos > span:nth-of-type(even) {
font-weight: bold;
}
#carImg {
position: relative;
top: 85px;
right: 6%;
display: block;
margin: 0 auto;
float: right;
width: 47%;
border-radius: 15px;
}
.containerFuel {
width: 40%;
display: inline-block;
position: relative;
}
.imageFuel {
width: 40%;
margin-top: 18px;
margin-bottom: 18px;
border-radius: 15px;
}
.iconFuelOrMileage {
width: 49px;
}
</style>
<style>
#healthCheck {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#topBar {
height: 100 px;
width: 100%;
background: #f4f4f4 !important;
box-shadow: 0 4px 2px -2px #e1e1e1;
margin-bottom: 4px;
text-align: left;
padding-bottom: 10 px;
}
/*#topBar > div {
/*position: relative;
/*display: inline-block;
}*/
/*#topBar > div: nth-of-type(1) {
margin-top: 25 px;
margin-left: 30 px;
margin-bottom: 15 px;
}*/
/*
#topBar > .green {
}
#topBar > div:nth-of-type(n+2) {
margin-bottom: 9px;
vertical-align: middle;
}
#topBar > div:nth-of-type(n+4):nth-of-type(even) {
margin-left: 22px;
}
#topBar > div:nth-of-type(n+3):nth-of-type(odd) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#topBar > div:nth-of-type(1) > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}*/
.CategoryTitle, .CategoryContent {
}
.CategoryTitle > div, .CategoryContent > div {
margin-left: 30px;
position: relative;
}
.CategoryTitle {
height: 45px;
width: 100%;
}
/* From all div into .CategoryTitle keep the first one */
.CategoryTitle > div:nth-of-type(1) {
display: inline-block;
top: 15px;
vertical-align: middle;
font-size: 14px;
font-weight: bold;
color: #343434;
}
.CategoryContent {
height: 25px;
width: 100%;
}
.CategoryContent > .green, .CategoryContent > .yellow, .CategoryContent > .red {
float: right;
margin-right: 30px;
margin-top: 6px;
}
/* From all div into .CategoryContent keep the first one */
.CategoryContent > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: normal;
color: #343434;
}
#healthCheckBot {
margin-bottom: 62px;
text-align: center;
}
#fakeContent {
height: 150px;
}
</style>
<style>
#bodyPaint {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#BodyTitle > span {
position: relative;
display: block;
margin-left: 30px;
}
#BodyTitle > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
#BodyTitle > span:nth-of-type(2) {
margin-top: 22px;
font-size: 17px;
font-weight: normal;
color: #343434;
}
.BodyPaintPictureContainer {
position: relative;
display: block;
width: 100%;
height: 415px;
margin: 0 auto;
border: 1px solid black;
background-color: #343434;
}
.BodyPaintPicture {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
#bodyPaintBot {
margin-bottom: 50px;
}
</style>
<style>
#signatures {
position: relative;
display: block;
width: 100%;
height: 450px;
}
#signaturesTitles {
position: absolute;
top: 50px;
}
#signatureOne, #signatureTwo {
position: relative;
display: inline-block;
}
#signatureOne {
margin-left: 30px;
}
#signatureTwo {
margin-left: 21px;
}
#signatureOne > div:nth-of-type(1), #signatureTwo > div:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
margin-bottom: 40px;
}
.signatureBlock {
width: 340px;
height: 300px;
background: #ffffff !important;
box-shadow: 0 0 2px 1px #8a8a8a inset;
}
</style>
<style>
/* new balises */
.containerBodyDamageElement {
margin-top: 40px;
width: 45%;
display: inline-block;
text-align: center;
}
.containerPictureDamage {
display: inline-block;
width: 45%;
}
.pictureDamage {
display: inline-block;
width: 50px;
}
.imgDamage {
width: 100px;
}
.containerContentDamage {
}
.containerSidePictureAndType {
display: -webkit-box;
top: 120px;
position: absolute;
}
.iconSideDamage {
width: 50px;
margin-left: 140px;
}
.typeDamage {
}
.commentDamage {
width: 150px;
height: 150px;
}
#annexe {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#annexeTitle {
position: relative;
display: block;
padding-top: 50px;
margin-left: 30px;
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
.annexePortrait {
}
.annexePicPortrait {
vertical-align: middle;
position: relative;
display: inline-block;
margin-left: 30px;
width: 200px;
height: 268px;
}
.annexeImg {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.picto {
position: relative;
display: inline-block;
vertical-align: top;
height: 180px;
width: 85px;
}
.pictoNum {
position: absolute;
display: inline-block;
margin-left: 25px;
width: 45px;
height: 45px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #c3002f !important;
}
.numInside {
position: relative;
display: block;
top: 13px;
text-align: center;
font-size: 15px;
font-weight: bold;
color: #ffffff;
}
.pictoDmg {
position: absolute;
right: 0;
width: 70px;
height: 70px;
}
.imgDmg {
height: 80%;
width: 80%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.comment {
margin-top: 30px;
}
.dmgComment {
margin-top: 15px;
font-size: 10px;
}
.comment > .dmgType > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: bold;
color: #343434;
}
.comment > .dmgType > div:nth-of-type(2) {
display: inline-block;
font-size: 10px;
font-weight: normal;
color: #343434;
}
#disclaimer {
font-size: 10px;
color: #343434;
}
</style>
My Html code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<div id="header">
<div>
<div id="custDetail">
<div id="custTitle">
<span>#CUSTOMER_DETAILS#</span>
</div>
<div id="custInfos">
<span>#NAME_LABEL# : </span>
<span>#NAME#</span>
<div> <br> </div>
<span>#PHONE_LABEL# : </span>
<span>#PHONE#</span>
</div>
<div id="vehicleDescription">
<span><b>J11 Qashqai Tekna 5DR Wagon 1.6L Turbo Diesel 4WD 4 Cyl 6sp Manual</b></span>
</div>
<div id="vehicleTitle">
<span>#VEHICLE_DETAILS#</span>
</div>
<div id="vehicleInfos">
<span>#VIN_LABEL# : </span>
<span><b>#VIN#</b></span>
<div> <br> </div>
<span>#MODEL_LABEL# : </span>
<span><b>#MODEL#</b></span>
<div> <br> </div>
<span>#REG_NUM_LABEL# : </span>
<span><b>#REG_NUM#</b></span>
<div> <br> </div>
<span>#KILOMETER_LABEL# : </span>
<span><b>#KILOMETER#</b></span>
<div> <br> </div>
<span>#CARBURANT_LABEL# : </span>
<span><b>#CARBURANT#</b></span>
<div> <br> </div>
</div>
<div>
</div>
</div>
</div>
<div id="containerImageFuelAndMileage">
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #MILEAGE# : <b>#MILEAGE_VALUE#</b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #FUEL# : <b>#FUEL_VALUE# </b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" name="" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
</div>
<div id="healthCheckBot">
<p> Page 1 </p>
</div>
<div class="footer"></div>
<div>
<div id="healthCheck">
<div id="topBar">
<div>
#Test#
</div>
</div>
</div>
</div>
</body>
</html>