My Checkbox and Radio boxes do not align with the associated text - html

I am currently creating a bit of a fun project. For some reason, my text and check / radio boxes do not align with the text. They seem to be off to one side and higher than the text.
Here is my pen - https://codepen.io/Amnesia180/pen/RwKQOKP
html,
body {
line-height: 1.5;
height: 100%;
margin: 0 auto;
font-family: 'Quicksand', sans-serif;
color: #070707;
}
header {
position: relative;
top: 0;
padding: 0;
background-color: #EFEFEF;
width: 100%;
height: 60px;
}
.material-icons {
color: #505050;
}
#nav-bar {
position: relative;
display: flex;
justify-content: space-between;
padding: 10px;
}
ul {
display: flex;
padding: 0;
list-style: none;
}
li {
padding: 0px 20px;
}
.nav-link-left {
float: left;
text-decoration: none;
color: #070707;
font-weight: 800;
}
.nav-link {
float: right;
text-decoration: none;
color: #070707;
font-weight: 800;
}
.nav-link:hover {
float: right;
color: #5873D9;
border-bottom: 3px solid #5873D9;
padding-bottom: 5px;
}
#intro {
display: flex;
flex-direction: column;
align-items: center;
height: 470px;
margin-top: 50px;
max-width: 90em;
}
h1 {
font-size: 4em;
color: #34D1BF;
}
h2 {
color: #5873D9;
margin-top: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
font-size: 1.5em;
padding: 10px 0;
}
input {
width: 100%;
height: 30px;
border: 2px solid #34D1BF;
padding: 5px;
}
#submit {
background-color: #34D1BF;
width: 40%;
height: 40px;
margin-top: 15px;
margin-left: 30%;
margin-right: 30%;
border: 2px solid #34D1BF;
color: white;
}
#about,
#promo-image,
#burger {
max-width: 50em;
width: 90vw;
margin: 0 auto;
padding: 5px;
text-align: left;
}
#promoimage {
display: block;
margin: 0 auto;
max-width: 518px;
width: 100%;
}
#burgers {
margin-top: 40px;
flex-direction: column;
align-items: center;
text-align: center;
justify-content: space-around;
}
.box {
border: 2px solid #EFEFEF;
border-radius: 5px;
margin: 2px;
text-align: center;
}
.price {
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
}
.price li {
padding: 30px;
border: 0.5px solid #EFEFEF;
}
.card-header {
background-color: rgba(52, 209, 191, 1);
color: white;
}
footer {
width: 100%;
background-color: #EFEFEF;
height: 80px;
text-align: center;
}
footer p {
padding-top: 20px;
}
.burgerform {
text-align: left;
display: inline;
}
.burgerform label {
font-size: 1.5em;
font-weight: bold;
}
.burgerform legend {
font-weight: bold;
}
#media (min-width: 600px) {
#intro {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-evenly;
}
#burgers {
display: flex;
flex-direction: row;
align-items: center;
text-align: center;
justify-content: space-between;
}
}
<label>Sauces</label>
<p/> Burger Sauce <input type="checkbox" id="burgersauce" name="burgersauce" onclick="calculateTotal()"> Dirty Mayo Sauce
Can anyone advise?
Thanks!

Your inputs have width: 100%; which means it'll occupy entire width. And the "label" is just plain text so they are just flowing into the next line.
If you want to align them then you need proper elements (label>) aligned within 100% of the same line.

That is because you have given your inputs a width of 100%, so now each checkbox and radiobutton spans the whole width of the screen.
input {
width: 100%;
height: 30px;
border: 2px solid #34D1BF;
padding: 5px;
}
You can debug CSS issues using the CSS developer tools of your browser, as in the attached screenshot

Wrap both label (eg. Burger Mayo Sauce) and checkbox within a Flex-box, apply 100% width to it, and justify-content:space-between.
.menu-item{
witdh: 100%;
display:flex;
justify-content:space-between;
}
input[type=checkbox]{
//Whatever styling you want to apply to the checkbox.
}
Do not add the 100% width to the input, flexbox will manage the space for you.

Related

How use media-quires in CSS?

I'm making web-site , and i need make adaptive site. So i began use media-quires and got a trouble. When screen resolution has been changing in example since 2560px to 1920px , some styles remain in site, however they hasn't written in code CSS, why ?
#media only screen and (max-width: 2560px ) {
body {
background-color: #344B56;
color: white;
font-family: Montserrat;
margin: 0px;
padding-top: 20px;
}
.container {
margin: 0 auto;
}
.info {
display: flex;
justify-content: space-around;
align-items: flex-start;
padding-bottom: 5px;
}
.company {
text-decoration: none;
color: white;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
font-size: 30px;
text-align: center;
}
.company p {
margin: 0px;
}
.hours, .adress, .callback {
display: flex;
align-items: flex-start;
}
.logo {
width: 50px;
padding-top: 12px;
padding-right: 10px;
}
.navbar {
display: flex;
justify-content: space-evenly;
padding: 20px;
border-top: 1px white solid;
border-radius: 50px;
}
.completed {
font-size: 20px;
font-family: Montserrat;
border-bottom: 2px skyblue solid;
border-radius: 5px;
margin: 0px;
padding: 0px;
}
.navbar a {
letter-spacing: -2px;
color: white;
font-size: 20px;
font-family: Montserrat;
text-decoration: none;
}
.navbar a:hover {
color: skyblue;
}
.company_info {
display: flex;
justify-content: space-around;
align-items: center;
background-color: #323a42;
}
.company_text {
display: flex;
flex-direction: column;
width: 500px;
padding: 50px;
}
.infoCompany {
background-image: url("./images/companyBack.jpeg");
background-position: center center;
background-size: cover;
width: 100%;
height: 600px;
}
.infoCompany__Text {
display: flex;
flex-direction: column;
color: white;
width: 100%;
font-size: 26px;
}
.infoCompany__Text_Company {
display: flex;
margin-top: 100px;
margin-left: 200px;
}
.Service {
margin-top: 50px;
margin-left: 200px;
margin-right: 200px;
color: white;
font-size: 24px;
}
.Service__Products {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.Service__Products_Product {
display: flex;
flex-direction: column;
margin-top: 50px;
}
.Service__Products_Product:not(first-child) {
margin-left: 150px;
}
.Product__img {
width: 500px;
height: 402px;
border-top-left-radius: 30px;
border-top-right-radius: 30px;
}
.Product__DownPartCard {
display: flex;
}
.Product__LeftDivCard {
width: 24px;
height: 98px;
background-color: #1A81AD;
}
.Product__NameCardDiv {
width: 476px;
height: 98px;
background: white;
}
.Product__DownPartCard_Text {
font-size: 18px;
display: flex;
color: black;
padding-left: 15px;
padding-top: 30px;
}
.Garant {
color: white;
margin-top: 100px;
margin-left: 200px;
margin-right: 200px;
color: white;
font-size: 24px;
}
.Garant__Garants {
margin-top: 70px;
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.Garant__Card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.Gatant__Card_Img {
width: 150px;
height: 150px;
}
.Gatant__Card_Text {
font-size: 16px;
}
footer {
margin-top: 70px;
position: absolute;
width: 100%;
border-top: 1px white solid;
}
.invisible {
opacity: 0;
}
}
#media only screen and (max-width: 1920px ) {
body {
background-color: #344B56;
color: white;
font-family: Montserrat;
margin: 0px;
padding-top: 20px;
}
.container {
margin: 0 auto;
}
.info {
display: flex;
justify-content: space-around;
align-items: flex-start;
padding-bottom: 5px;
}
.company {
text-decoration: none;
color: white;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
font-size: 30px;
text-align: center;
}
.company p {
margin: 0px;
}
.hours, .adress, .callback {
display: flex;
align-items: flex-start;
}
.logo {
width: 50px;
padding-top: 12px;
padding-right: 10px;
}
.navbar {
display: flex;
justify-content: space-evenly;
padding: 20px;
border-top: 1px white solid;
border-radius: 50px;
}
.completed {
font-size: 20px;
font-family: Montserrat;
border-bottom: 2px skyblue solid;
border-radius: 5px;
margin: 0px;
padding: 0px;
}
.navbar a {
letter-spacing: -2px;
color: white;
font-size: 20px;
font-family: Montserrat;
text-decoration: none;
}
.navbar a:hover {
color: skyblue;
}
.company_info {
display: flex;
justify-content: space-around;
align-items: center;
background-color: #323a42;
}
.company_text {
display: flex;
flex-direction: column;
width: 500px;
padding: 50px;
}
.infoCompany {
background-image: url("./images/companyBack.jpeg");
background-position: center center;
background-size: cover;
width: 100%;
height: 600px;
}
.infoCompany__Text {
display: flex;
flex-direction: column;
color: white;
width: 100%;
font-size: 26px;
}
.infoCompany__Text_Company {
display: flex;
margin-top: 100px;
margin-left: 200px;
}
.Service {
margin-top: 50px;
margin-left: 200px;
margin-right: 200px;
color: white;
font-size: 24px;
}
.Service__Products {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.Service__Products_Product {
display: flex;
flex-direction: column;
margin-top: 50px;
}
.Product__img {
width: 400px;
height: 302px;
border-top-left-radius: 30px;
border-top-right-radius: 30px;
}
.Product__DownPartCard {
display: flex;
}
.Product__LeftDivCard {
width: 12px;
height: 98px;
background-color: #1A81AD;
}
.Product__NameCardDiv {
width: 388px;
height: 98px;
background: white;
}
.Product__DownPartCard_Text {
font-size: 15px;
display: flex;
color: black;
padding-left: 15px;
padding-top: 30px;
}
.Garant {
color: white;
margin-top: 100px;
margin-left: 200px;
margin-right: 200px;
color: white;
font-size: 24px;
}
.Garant__Garants {
margin-top: 70px;
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.Garant__Card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.Gatant__Card_Img {
width: 150px;
height: 150px;
}
.Gatant__Card_Text {
font-size: 16px;
}
footer {
margin-top: 70px;
position: absolute;
width: 100%;
border-top: 1px white solid;
}
.invisible {
opacity: 0;
}
}
#media only screen and (max-width: 1500px) {
body {
background-color: #344B56;
color: white;
font-family: Montserrat;
margin: 0px;
padding-top: 20px;
}
.container {
margin: 0 auto;
}
.info {
display: flex;
justify-content: space-around;
align-items: flex-start;
padding-bottom: 5px;
}
.company {
text-decoration: none;
color: white;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
font-size: 30px;
text-align: center;
}
.company p {
margin: 0px;
}
.hours, .adress, .callback {
display: flex;
align-items: flex-start;
}
.logo {
width: 50px;
padding-top: 12px;
padding-right: 10px;
}
.navbar {
display: flex;
justify-content: space-evenly;
padding: 20px;
border-top: 1px white solid;
border-radius: 50px;
}
.completed {
font-size: 20px;
font-family: Montserrat;
border-bottom: 2px skyblue solid;
border-radius: 5px;
margin: 0px;
padding: 0px;
}
.navbar a {
letter-spacing: -2px;
color: white;
font-size: 20px;
font-family: Montserrat;
text-decoration: none;
}
.navbar a:hover {
color: skyblue;
}
.company_info {
display: flex;
justify-content: space-around;
align-items: center;
background-color: #323a42;
}
.company_text {
display: flex;
flex-direction: column;
width: 500px;
padding: 50px;
}
.infoCompany {
background-image: url("./images/companyBack.jpeg");
background-position: center center;
background-size: cover;
width: 100%;
height: 600px;
}
.infoCompany__Text {
display: flex;
flex-direction: column;
color: white;
width: 100%;
font-size: 26px;
}
.infoCompany__Text_Company {
display: flex;
margin-top: 100px;
margin-left: 200px;
}
.Service {
color: white;
font-size: 24px;
text-align: center;
}
.Service__Products {
display: flex;
flex-wrap: wrap;
}
.Service__Products_Product {
width: 100%;
display: flex;
flex-direction: column;
margin: 50px 0 0 0;
}
.Product__img {
width: 400px;
height: 302px;
border-top-left-radius: 30px;
border-top-right-radius: 30px;
}
.Product__downPartCard {
display: flex;
}
.Product__leftDivCard {
width: 12px;
height: 98px;
background-color: #1A81AD;
}
.Product__NameCardDiv {
width: 388px;
height: 98px;
background: white;
}
.Product__DownPartCard_Text {
font-size: 15px;
display: flex;
color: black;
padding-left: 15px;
padding-top: 30px;
}
.Garant {
color: white;
margin-top: 100px;
margin-left: 200px;
margin-right: 200px;
color: white;
font-size: 24px;
}
.Garant__Garants {
margin-top: 70px;
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.Garant__Card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.Gatant__Card_Img {
width: 150px;
height: 150px;
}
.Gatant__Card_Text {
font-size: 16px;
}
footer {
margin-top: 70px;
position: absolute;
width: 100%;
border-top: 1px white solid;
}
.invisible {
opacity: 0;
}
}
So "margin-left: 150px ;" from media 2560px somehow using in 1920px, why ?
.Service__products_Product:not(first-child) {
margin-left: 150px ;
}
/* Extra small devices (phones, 360px) to Large devices (laptops/desktops, 1920px) */
#media screen and (min-width: 360px) and (max-width: 1920px) { css here...}
/* Extra Large devices (laptops/desktops, 1921px and up) */
#media screen and (min-width: 1921px) {css here...}

Flexbox <p> element overlapping image on page resize

When I resize my page, the text from my right column overlaps the image in the left column, like so:
How do I stop this and make the right column stay where it is, or go below the image when the page is resized? I don't want to change the layout of the page when it's fullscreen, but I want it to be responsive.
#import url(https://fonts.googleapis.com/css?family=Raleway);
body {
margin: 0;
font-family: 'Raleway', georgia, arial;
background-color: #e0e0e0;
text-align: center;
}
h1 {
color: #aaaaaa;
text-align: left;
}
.sortFilms {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
header {
text-align: center;
display: inline-block;
border-bottom: 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-style: solid;
border-color: #aaaaaa;
width: 80%;
padding: 20px;
background-color: #e0e0e0;
}
.newFilm {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
label {
font-size: 1em;
padding: 6px;
color: #fff;
font-weight: 700;
display: block;
text-align: left;
}
.form {
margin: auto;
display: flex;
text-align: center;
flex-direction: column;
}
h2 {
font-weight: 700;
font-size: 2em;
width: 50%;
color: #B2365F;
}
#formTitle {
margin-top: 0;
margin-bottom: 0;
}
.row {
margin-left: -20px;
display: grid;
grid-template-columns: 1fr 1fr;
}
.col {
padding: 20px;
}
input,
textarea,
select {
width: 100%;
display: block;
border-radius: 25px;
background-color: #e0e0e0;
padding: 10px;
border: none;
box-sizing: border-box;
}
}
.tagline {
margin: 0;
color: #333333;
font-size: 1em;
font-weight: 700;
}
input::placeholder {
color: #000;
}
textarea::placeholder {
color: #000;
}
#modifyFilmButton {
float: right;
}
#media only screen and (max-width: 700px) {
.row {
grid-template-columns: 1fr;
}
}
#media screen and (max-width:800px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border: 2px solid #e0e0e0;
background-color: #e0e0e0;
display: block;
margin-bottom: .625em;
border-radius: 20px;
}
table td {
display: block;
font-weight: bold;
font-size: 1.2em;
text-align: left;
padding: 15px;
}
table td::before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
.oldFilm {
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
text-align: left;
display: inline-block;
background-color: #AAAAAA;
width: 80%;
padding: 20px;
}
#oldTitle {
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
padding-bottom: 20px;
}
td {
padding: 5px;
font-weight: bold;
}
table {
border-collapse: collapse;
text-align: center;
width: 100%;
}
thead {
background: #ff6699;
}
.reviewImage {
width: 200px;
border-radius: 20px;
}
.filmRow img {
width: 300px;
height: 420px;
margin: 10px;
border-radius: 20px;
}
.filmRow {
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
#filmContainer {
width: 100%;
margin-top: 10px;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#date {
padding: 5px;
text-align: left;
width: 30%;
}
#date input {
width: auto;
}
#date label {
display: -webkit-inline-box;
}
#oldTitle2 {
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
}
.genre {
padding: 5px;
text-align: left;
width: 60%;
}
.genre input {
width: auto;
}
.genre label {
display: -webkit-inline-box;
}
/* third page */
#filmImage {
width: 300px;
height: 420px;
margin: 10px;
border-radius: 20px;
}
#filmTitle {
font-weight: 700;
margin-bottom: 20px;
font-size: 3em;
width: 100%;
color: #B2365F;
}
#leftcol {
width: 25%;
display: flex;
flex-direction: column;
}
#rightcol {
display: flex;
flex-direction: column;
width: 50%;
margin: 5px;
}
#rightcol label {
padding: 0;
}
#rightcol p {
margin-bottom: 10px;
margin-top: 2px;
}
#filmContainer2 {
width: 100%;
margin-top: 10px;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: center;
}
#indent {
margin: 5px;
}
<header>
<img src="img/rv-logo.png">
<p class="tagline">Want to know whether or not it's worth paying to watch a certain film or not? See what we think first!</p>
</header>
<div class="sortFilms">
<div id="filmContainer2">
<div id="leftcol">
<img id='filmImage' src="https://images-na.ssl-images-amazon.com/images/I/51Gh9OaWVcL.jpg">
</div>
<div id="rightcol">
<p id='filmTitle'>Deadpool</p>
<div id="indent">
<label>Year:</label>
<p id='filmYear'>2016</p>
<label>Genre:</label>
<p id='filmGenre'>Action/Comedy</p>
<label>Rating:</label>
<p id='filmRating'>9/10</p>
<label>Synopsis:</label>
<p id='filmSynopsis'>blah blah blah blah</p>
</div>
<a href='viewFilms.html'>Back to list</a>
</div>
</div>
</div>
The problem is with your image the div containing the image has 25% width, but your image has a width which is larger than 25% of its parent so the image overflows its parent. You should not do like that try to set the image width to 100%.
To fix your problem set the width of the image to 100% and adjust the width of its parent to adjust image size
And one more tip if you're using flexbox use the property flex-wrap:wrap...so the divs inside the flex will automatically shift down according to screen size
To learn more about flex check this link out
https://css-tricks.com/snippets/css/a-guide-to-flexbox/

How do I achieve this layout with CSS?

I have some Javascript pulling information from a database for various films, but the layout of the page is dreadful, I want to achieve something similar to the layout in the screenshot below:
but this is how it looks right now:
How would I go about achieving a layout similar to the one in the top image?
Here is my code (tweaked so you can see content, though the divs would actually be empty without the database usually)
#import url(https://fonts.googleapis.com/css?family=Raleway);
body {
margin: 0;
font-family: 'Raleway', georgia, arial;
background-color: #e0e0e0;
text-align: center;
}
h1 {
color: #aaaaaa;
text-align: left;
}
.sortFilms {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
header {
text-align: center;
display: inline-block;
border-bottom: 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-style: solid;
border-color: #aaaaaa;
width: 80%;
padding: 20px;
background-color: #e0e0e0;
}
.newFilm {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
label {
font-size: 1em;
padding: 6px;
color: #fff;
font-weight: 700;
display: block;
text-align: left;
}
.form {
margin: auto;
display: flex;
text-align: center;
flex-direction: column;
}
h2 {
font-weight: 700;
font-size: 2em;
width: 50%;
color: #B2365F;
}
#formTitle {
margin-top: 0;
margin-bottom: 0;
}
.row {
margin-left: -20px;
display: grid;
grid-template-columns: 1fr 1fr;
}
.col {
padding: 20px;
}
input,
textarea, select {
width: 100%;
display: block;
border-radius: 25px;
background-color: #e0e0e0;
padding: 10px;
border: none;
box-sizing:border-box; }
}
.tagline {
margin: 0;
color: #333333;
font-size: 1em;
font-weight: 700;
}
input::placeholder {
color: #000;
}
textarea::placeholder {
color: #000;
}
#modifyFilmButton {
float: right;
}
#media only screen and (max-width: 700px) {
.row {
grid-template-columns: 1fr;
}
}
#media screen and (max-width:800px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border: 2px solid #e0e0e0;
background-color: #e0e0e0;
display: block;
margin-bottom: .625em;
border-radius: 20px;
}
table td {
display: block;
font-weight: bold;
font-size: 1.2em;
text-align: left;
padding: 15px;
}
table td::before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
.oldFilm {
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
text-align: left;
display: inline-block;
background-color: #AAAAAA;
width: 80%;
padding: 20px;
}
#oldTitle {
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
padding-bottom: 20px;
}
td {
padding: 5px;
font-weight: bold;
}
table {
border-collapse: collapse;
text-align: center;
width: 100%;
}
thead {
background: #ff6699;
}
.reviewImage {
width: 200px;
border-radius: 20px;
}
.filmRow img {
width: 300px;
height: 420px;
margin: 10px;
border-radius: 20px;
}
.filmRow {
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
#filmContainer {
width: 100%;
margin-top: 10px;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#date {
padding: 5px;
text-align: left;
width: 30%;
}
#date input {
width: auto;
}
#date label {
display: -webkit-inline-box;
}
#oldTitle2 {
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
}
.genre {
padding: 5px;
text-align: left;
width: 60%;
}
.genre input {
width:auto;
}
.genre label {
display: -webkit-inline-box;
}
/* third page */
#filmImage {
width: 300px;
height: 420px;
margin: 10px;
border-radius: 20px;
}
#filmTitle {
font-weight: 700;
margin: 0;
font-size: 3em;
width: 100%;
text-align: center;
color: #B2365F;
}
<header>
<img src="img/rv-logo.png">
<p class="tagline">Want to know whether or not it's worth paying to watch a certain film or not? See what we think first!</p>
</header>
<div class="sortFilms">
<div id="filmContainer">
<img id='filmImage'src="https://images-na.ssl-images-amazon.com/images/I/51Gh9OaWVcL.jpg">
<p id='filmTitle'>Deadpool</p>
<label>Year:</label><p id='filmYear'>2016</p>
<label>Genre:</label><p id='filmGenre'>Comedy</p>
<label>Rating:</label><p id='filmRating'>9</p>
<label>Synopsis:</label><p id='filmSynopsis'>Just Ryan Reynolds, doing Ryan Reynolds things in a tight suit.</p>
<a href='viewFilms.html'>Back to list</a>
</div>
</div>
(ignore the font on the text in the ideal layout, I just used the last one I used on Photoshop)
Any help would be greatly appreciated.
try separate the image and the text in the different div.
make two column, and adjust the width accordingly with the CSS.
<div id="filmContainer">
<div id="leftcolumn">
<img id='filmImage'src="https://images-na.ssl-images-amazon.com/images/I/51Gh9OaWVcL.jpg">
</div>
<div id="rightcolumn">
<p id='filmTitle'>Deadpool</p>
<label>Year:</label><p id='filmYear'>2016</p>
<label>Genre:</label><p id='filmGenre'>Comedy</p>
<label>Rating:</label><p id='filmRating'>9</p>
<label>Synopsis:</label><p id='filmSynopsis'>Just Ryan Reynolds, doing Ryan Reynolds things in a tight suit.</p>
<a href='viewFilms.html'>Back to list</a>
</div>
</div>
First, you should convert most, of not all your IDs to CLASS tags. You don't need to make them all ID and then it limits you from having multiple movie cards on one page.
Where's a JSfiddle I created for you, updating the html a little and mostly the CSS.
HTML:
<header>
<img src="img/rv-logo.png">
<p class="tagline">Want to know whether or not it's worth paying to watch a certain film or not? See what we think first!</p>
</header>
<div class="sortFilms">
<div id="filmContainer">
<div class="poster">
<img id='filmImage'src="https://images-na.ssl-images-amazon.com/images/I/51Gh9OaWVcL.jpg">
</div>
<div class="info">
<p id='filmTitle'>Deadpool</p>
<label>Year:</label><p id='filmYear'>2016</p>
<label>Genre:</label><p id='filmGenre'>Comedy</p>
<label>Rating:</label><p id='filmRating'>9</p>
<label>Synopsis:</label><p id='filmSynopsis'>Just Ryan Reynolds, doing Ryan Reynolds things in a tight suit.</p>
<a href='viewFilms.html'>Back to list</a>
</div>
</div>
</div>
CSS (All of your original CSS is in there too, which could be cleaned up):
#import url(https://fonts.googleapis.com/css?family=Raleway);
body {
margin: 0;
font-family: 'Raleway', georgia, arial;
background-color: #e0e0e0;
text-align: center;
}
h1 {
color: #aaaaaa;
text-align: left;
}
.sortFilms {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
header {
text-align: center;
display: inline-block;
border-bottom: 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-style: solid;
border-color: #aaaaaa;
width: 80%;
padding: 20px;
background-color: #e0e0e0;
}
.newFilm {
text-align: left;
display: inline-block;
background-color: #ff6699;
width: 80%;
padding: 20px;
}
label {
font-size: 1em;
padding: 6px;
color: #fff;
font-weight: 700;
display: block;
text-align: left;
}
.form {
margin: auto;
display: flex;
text-align: center;
flex-direction: column;
}
h2 {
font-weight: 700;
font-size: 2em;
width: 50%;
color: #B2365F;
}
#formTitle {
margin-top: 0;
margin-bottom: 0;
}
.row {
margin-left: -20px;
display: grid;
grid-template-columns: 1fr 1fr;
}
.col {
padding: 20px;
}
input,
textarea, select {
width: 100%;
display: block;
border-radius: 25px;
background-color: #e0e0e0;
padding: 10px;
border: none;
box-sizing:border-box; }
}
.tagline {
margin: 0;
color: #333333;
font-size: 1em;
font-weight: 700;
}
input::placeholder {
color: #000;
}
textarea::placeholder {
color: #000;
}
#modifyFilmButton {
float: right;
}
#media only screen and (max-width: 700px) {
.row {
grid-template-columns: 1fr;
}
}
#media screen and (max-width:800px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border: 2px solid #e0e0e0;
background-color: #e0e0e0;
display: block;
margin-bottom: .625em;
border-radius: 20px;
}
table td {
display: block;
font-weight: bold;
font-size: 1.2em;
text-align: left;
padding: 15px;
}
table td::before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
.oldFilm {
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
text-align: left;
display: inline-block;
background-color: #AAAAAA;
width: 80%;
padding: 20px;
}
#oldTitle {
width:100%;
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
padding-bottom: 20px;
}
td {
padding: 5px;
font-weight: bold;
}
table {
border-collapse: collapse;
text-align: center;
width: 100%;
}
thead {
background: #ff6699;
}
.reviewImage {
width: 200px;
border-radius: 20px;
}
.filmRow img {
width: 300px;
height: 420px;
margin: 10px;
border-radius: 20px;
}
.filmRow {
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
#filmContainer {
width: 100%;
margin-top: 10px;
display: block;
position: relative;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#filmContainer .poster {
width:45%;
float:left;
}
#filmContainer .info {
width:50%;
float: right;
}
#filmContainer .info label {
float:left;
width: 25%;
padding:0;
margin: 5px 0;
}
#filmContainer .info p {
float:left;
width: 75%;
margin: 5px 0;
}
#filmContainer .info a {
display:block;
padding: 25px 0;
clear:both;
}
#filmContainer .info p#filmTitle {
width:100%;
clear:both;
margin-top: 0;
margin-bottom: 0;
padding-bottom: 20px;
float: unset;
text-align:left;
}
#date {
padding: 5px;
text-align: left;
width: 30%;
}
#date input {
width: auto;
}
#date label {
display: -webkit-inline-box;
}
#oldTitle2 {
margin-top: 0;
margin-bottom: 0;
color: #ff6699;
}
.genre {
padding: 5px;
text-align: left;
width: 60%;
}
.genre input {
width:auto;
}
.genre label {
display: -webkit-inline-box;
}
/* third page */
#filmImage {
width: 95%;
height: auto;
margin: 10px;
border-radius: 20px;
}
#filmTitle {
font-weight: 700;
margin: 0;
font-size: 3em;
width: 100%;
text-align: center;
color: #B2365F;
}
http://jsfiddle.net/sstracy/vaq60zyp/

layout changed once published live

I received help centering an image within a box using a "helper" pseudo element element, which was working until I published it live. I'm not sure what's going on.
you can see whats going on at live link. And this is the code I was using for the layout
Code:
.offer {
width: 288px;
float: left;
margin-right: 25px;
}
.box {
position: relative;
display: block;
border: solid 3px #19468d;
height: 310px;
width: 100%;
margin-top: 11px;
text-align: center;
}
.price span {
font-family: avenir next;
font-weight: 700;
background-color: #19468d;
color: white;
font-size: 21px;
padding: 0px 5px;
left: 0;
padding-left: 0;
}
.price a {
position: relative;
font-family: avenir next;
font-weight: 700;
background-color: #19468d;
color: white;
font-size: 21px;
padding: 1px 7px;
left: 3px;
bottom: 1px;
border-style: solid;
border-color: #19468d;
}
.price a:hover {
color: #19468d;
background-color: white;
border-style: solid;
}
#cost {
position: absolute;
left: 0px
}
#info {
position: absolute;
bottom: 0px;
right: 0px
}
.box img {
display: inline-block;
margin: 0 auto;
text-align: center;
max-width: 252px;
vertical-align: center;
}
#grid {
margin: 0px;
display: flex;
display: -webkit-flex;
/* Safari 8 */
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
/* Safari 8 */
-webkit-justify-content: center;
/* Safari 8 */
margin-left: 20px;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: middle;
}
.price {
text-align: left
}
.price #dollar {
padding-right: 0px;
padding-left: 5px;
}
<div class="offer">
<div class="box">
<div class="price">
<span id="dollar">$</span><span>27</span>
</div>
<span class="helper"></span>
<img src="http://cdn2.hubspot.net/hubfs/75704/JPs-Slices/2016_Yes/img/floorexammat.jpg">
<div class="price" id="info">
Buy Now
</div>
</div>
Rather use flex for the images. On the ".box" you can do
display:flex;
justify-content: center;
and remove the helper.

Header div disappears in Safari when screen width more than 1024px?

I'm trying to iron out browser inconsistancies in a website I've been building, and my main issue is that in Safari the header disappears when the screen width is more than 1024px. It's not just the image that isn't visable, everything inside the header is gone. It's fine at a narrower width, and in Firefox, Chrome and Opera.
Has anyone else experienced this? Does anyone know how to fix it?
Link to my Codepen below...
http://codepen.io/ajbater7/pen/aZzmjy
/******************************
GENERAL
******************************/
body {
font-family: "Montserrat","Open Sans","Arial",sans-serif;
display: flex;
flex-direction: column;
min-height: 100vh;
box-sizing: border-box;
}
.container {
flex: 1;
}
a {
text-decoration:none;
}
img {
max-width: 100%;
}
.top {
width: 20px;
height: 20px;
}
/******************************
CONTAINER
******************************/
.container {
padding-left: 5%;
padding-right: 5%;
margin: 50px auto;
}
a, a:visited {
color: #222222;
}
/******************************
HEADING
******************************/
.banner {
position: relative;
}
.name {
text-align:center;
margin: 0;
}
.name a {
padding-left: 10px;
padding-right: 10px;
display: block;
color: #fff;
}
.video-loop {
object-fit: cover;
width: 100%;
height: 100%;
background-color: black;
display: none;
}
.main-image {
object-fit: cover;
width: 100%;
height: 100%;
background-color: black;
position: relative;
}
.main-header {
position: relative;
width: 100%;
height: 100%;
}
.name-nav {
margin: auto;
position: absolute;
bottom: 20px; right: 0; left: 0;
}
h1 {
text-transform: uppercase;
font-family: "Montserrat","Open Sans","Arial",sans-serif;
font-weight: normal;
font-size: 1em;
line-height: 1.2em;
letter-spacing: 3px;
}
/******************************
NAVIGATION
******************************/
.main-nav {
text-align: center;
padding:5px 10px;
margin: 0;
font-family: "Montserrat","Open Sans","Arial",sans-serif;
font-weight: normal;
font-size: .7em;
text-transform: uppercase;
list-style-type: none;
letter-spacing: 2px;
}
.main-nav li {
margin-top: 8px;
margin-bottom: 8px;
}
.main-nav a {
font-weight: 300;
padding-left: 15px;
padding-right: 15px;
display: block;
color: #fff;
transition-duration: .5s;
transition-property: color;
}
.main-nav .selected, .main-nav a:hover {
color: #ffae00;
}
.main-nav .current {
color: #ffae00;
}
/******************************
GALLERY
******************************/
.feature {
text-transform: uppercase;
font-size: .7em;
margin-bottom: 25px;
color: #ffae00;
letter-spacing: 2px;
text-align: center;
}
.gallery {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: center;
text-align: center;
justify-content: center;
max-width: 900px;
margin: auto;
}
.thumb {
position: relative;
overflow: hidden;
max-width: 260px;
max-height: 100%;
line-height: 0;
margin: 10px;
}
.image-container img {
max-width: 100%;
}
.thumb:hover img, .thumb:focus img {
transform: scale(1.37);
transition-duration: .4s;
transition-timing-function: ease-out;
}
.photo-overlay {
position: absolute;
color: #fff;
top: 0;
right: 0;
bottom: 0;
left: 0%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0 auto;
background-color: rgba(255, 174, 0, .8);
text-align: left;
opacity: 0;
transition: opacity .7s ease-out;
}
.photo-overlay:hover {
opacity: 1;
}
.photo-overlay h3 {
font-size: 1em;
letter-spacing: 2px;
text-transform: uppercase;
margin: 5px 0;
border-bottom: 1px solid #fff;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 15px;
}
#top-line1, #top-line2, #top-line3 {
border: none;
padding-bottom: 5px;
}
.photo-overlay p {
margin: 5px 0;
font-size: .7em;
letter-spacing: 1px;
padding-top: 5px;
}
#behind {
padding-top: 0;
margin-top: 0;
}
/******************************
PAGE:ABOUT
******************************/
.about {
display: flex;
flex-direction: column;
align-items: center;
}
.showreel {
margin-bottom: 30px;
}
.about h3,
p {
font-size: 0.8em;
font-weight: normal;
text-align: center;
letter-spacing: 1px;
line-height: 2em;
}
/******************************
PAGE:CONTACT
******************************/
.contact-info {
list-style-type: none;
text-align: center;
padding: 0;
}
.contact-info img {
border-radius: 100%;
width: 80px;
height: 80px;
}
.contact-info h3 {
text-transform: uppercase;
letter-spacing: 2px;
}
.contact-info p {
font-size: 0.8em;
line-height: 2em;
letter-spacing: 1px;
}
.contact-info li {
padding-top: 20px;
padding-bottom: 20px;
}
/******************************
PAGE:FOOTER
******************************/
footer {
font-size: 0.7em;
text-align: center;
clear: both;
padding-top: 50px;
padding-bottom: 30px;
color: white;
background-color: #222222;
margin-top: auto;
}
footer h3 {
text-transform: uppercase;
letter-spacing: 2px;
/*
text-align: center;
*/
}
.social-icon {
width: 30px;
height: 30px;
margin: 0 5px;
}
.scroll img {
height: 20px;
width: 20px;
}
.scroll {
margin-top: 20px;
}
/******************************
MEDIA QUERIES
******************************/
#media (min-width: 769px) {
.container {
max-width:85%;
margin: 80px auto;
padding: 0 10%;
}
.main-header,
.main-nav {
display: flex;
}
.main-header {
flex-direction: column;
align-items: center;
}
.main-nav {
justify-content: center;
font-size: 0.8em;
}
.feature {
font-size: .8em;
}
.name-nav {
position: absolute;
bottom: 20px;
}
h1 {
font-size: 1.5em;
}
.contact-info {
display: flex;
width: 600px;
align-content: center;
justify-content: space-between;
margin: auto;
}
.contact-info li {
flex-basis: 25%;
}
}
#media (min-width: 1025px) {
.main-image {
display: none;
}
.video-loop {
display: unset;
}
/*
.video-loop {
visibility: visible;
}
*/
.main-header {
min-height: 100%;
min-width: 100%;
}
.name-nav {
display: flex;
flex-direction: row;
justify-content: space-between;
position: absolute;
bottom: 20px;
}
.contact-info {
width: 800px;
}
.name {
padding-left: 5%;
}
.main-nav {
padding-right: 5%;
}
.about {
flex-direction: row-reverse;
justify-content: center;
align-items: center;
}
.showreel {
max-width: 50%;
margin-left:40px;
}
.info {
max-width: 40%;
margin-right: 40px;
text-align: center;
}
}
Look here: flex
Click in the tab "known issue"
- In Chrome and Safari, the height of (non flex) children are not recognized in percentages. However Firefox and IE recognize and scale the children based on percentage heights.