First problem is the "about myself" (home_about_box), doing something that will not allow me to put it on top of an image. I think it has something to do with the margin, but I have not found a solution.
Second problem is that the images in the Portfolio section (portfolio_home), will not touch each other, it leaves a blank space between the pictures.
Last problem is with having a horizontal scrollbar on the bottom of my page. I have searched for a solution, but not found any.
If you have any solution, I would appreciate you posting the code and an explanation, as I am quite new to this!
Cheers! Any constructive feedback is well appreciated!
HTML
<section class="home.about">
<div class="about.bg">
<div class="home_about_box">
<h1>About Myself</h1>
<p>Lorem ipsum...</p>
<p>Lorem ipsum...</p>
</div>
</div>
</section>
<section class="portfolio_home" id="portfolio">
<h1>Some of my work</h1>
<figure class="port-item">
<!-- Portfolio 1 -->
<img src="https://i.imgur.com/eBRYWII.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Geofilters</p>
</figcaption>
</figure>
<!-- Portfolio 2 -->
<figure class="port-item">
<img src="https://i.imgur.com/gAfgliA.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Quixz eSports</p>
</figcaption>
</figure>
<!-- Portfolio 3 -->
<figure class="port-item">
<img src="https://i.imgur.com/IjoGmUT.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>3D Renders</p>
</figcaption>
</figure>
<!-- Portfolio 4 -->
<figure class="port-item">
<img src="https://i.imgur.com/4zymXa8.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Backgrounds</p>
</figcaption>
</figure>
</section>
<section class="cta">
<div class="container">
<h1 class="title title-cta">Want to see more?
<span>Then what are you waiting for?</span>
</h1>
See More
</div>
</section>
CSS
* {
box-sizing: border-box;
transition: all ease-in-out 250ms;
}
body {
margin: 0;
font-family: "Lato", sans-serif;
text-align: center;
}
img {
max-width: 100%;
height: auto;
padding: 1em .5em 0;
background-size: cover;
}
.container {
width: calc(100%-4px);
margin: 0 auto;
}
/* Header
========= */
header {
position: absolute;
width: 100%;
}
nav ul {
margin: 0;
padding: 1em 0;
list-style: none;
}
nav li {
display: inline-block;
margin: .5em
}
nav a {
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
font-size: .9rem;
padding: .5em;
color: #FFF;
}
nav a:hover,
nav a:focus{
color: #DDD;
}
#media (min-width: 60rem) {
.logo{
float: left;
text-align: center;
align-content: center;
}
nav{
float: right;
text-align: center;
margin-right: 1em;
}
}
/* Buttons
========== */
.button_top {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #174FC1;
padding: .5em 1em;
color: #FFF;
}
.button_top:hover,
.button_top:focus {
background: #174FC1;
color: #FFF;
}
.button_dark {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #FFF;
padding: .5em 1em;
color: #FFF;
margin-bottom: 1em;
}
.button_dark:hover,
.button_dark:focus {
background: #FFF;
color: #000;
}
#media (min-width: 25rem) {
.button_top {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_top {
font-size: 2.4rem;
padding: .3em 1em;
margin-top: -1em;
}
}
#media (min-width: 25rem) {
.button_dark {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_dark {
font-size: 2rem;
padding: .3em 1em;
}
}
.clearfix::after,
section::after,
footer::after{
content: "";
display: block;
clear: both;
}
/* Typography
========= */
.title {
font-size: 2rem;
margin-bottom: 1.6em;
margin-top: 5em;
}
.title span {
font-weight: 300;
display: block;
font-size: 1.3rem;
}
.title-cta {
margin: 0 0 1em;
}
#media (min-width: 60rem) {
.title{
font-size: 4rem;
margin-top: 1.5em;
}
}
h1 {
font-weight: 800;
margin-top: 0;
}
.unstyled-list {
margin: 0;
padding: 1.3em;
list-style-type: none;
text-align: left;
}
/* Home.hero
========= */
.home-hero {
background-image: url(https://i.imgur.com/yUFKqAe.jpg);
background-size: cover;
background-position: center;
padding: 1em;
color: #FFF;
width: 100vw;
height: 100vh;
}
#media (min-width: 25rem) {
.home-hero{
width: 100vw;
height: 100vh;
}
}
#media (min-width: 60rem) {
.home-hero{
width: 100vw;
height: auto;
}
}
#media (min-height: 30rem) {
.home-hero{
width: 100vw;
height: 100vh;
}
}
/*Home About */
.home_about_box {
background-color: #232323;
font-size: .8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #FFF;
position: relative
}
.home_about_box h1 {
color: #174fc1;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 1.3em;
background: #232323;
padding: 0 0.5em
}
#media (min-width: 25rem) {
h1 {
font-size: 1.6rem;
}
.home_about_box h1 {
top: 1.3rem;
}
}
#media (min-width: 60rem) {
h1 {
font-size: 1.2rem;
}
.about.bg {
background-image: url(https://i.imgur.com/aTF2hwR.jpg);
padding: 5em;
}
.home_about_box {
font-size: .8em;
width: 25em;
margin: 0;
}
.home_about_box h1 {
top: 1.5rem;
}
}
/* portfolio
*/
.portfolio_home {
margin: 1.8em 0 0;
background-size: cover;
}
.portfolio_home h1 {
color: #174FC1;
font-size: 3em;
margin: auto;
padding: 0 0 .3em 0;
}
.port-item {
margin: 0;
position: relative;
}
.port-item img {
display: block;
}
.port-desc {
position: absolute;
z-index: 100;
bottom: 0em;
left: 0em;
right: 0em;
color: #FFF;
background: rgba(0,0,0,.75);
padding-bottom: 1em;
padding-top: 1em;
}
.port-desc p {
margin: .5em;
background-size: 100% 100%;
}
#media (min-width: 40rem) {
.port-item {
width: 50%;
float: left;
}
}
#media (min-width: 60rem) {
.port-item {
width: 33.3333334%;
float: left;
overflow: hidden
}
.port-desc {
transform: translateY(150%);
}
.port-item:hover .port-desc {
transform: translateY(0%)
}
}
/* CTA
*/
.cta{
background-color: #174fc1;
padding: 0.1em;
}
.cta h1 {
margin-top: 1em;
color: #FFF
}
/* Footer */
footer {
background: #232323;
color: #FFF;
}
Firstly you need to minimize the codepen like the this you don't need everything in it.
First Problem:-
For the first issue make sure your z-index is greater than the element overlapping it in your case it's .port-desc giving a z-index of 100 so you need something more than 100.
.home_about_box {
background-color: #232323;
font-size: 0.8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #fff;
z-index: 101;
}
Second Problem:-
You need to remove the padding on left and right I assume that's what you meant when you say they are not touching.
img {
max-width: 100%;
height: auto;
padding: 1em 0.5em 0;
background-size: cover;
}
Third Problem:-
The scrollbar is due to width being 100wh, you can update the width to be 100%.
#media (min-height: 30rem) {
.home-hero {
width: 100%;
height: 100vh;
}
}
Related
I'm doing an assignment in my class with HTML and CSS. I'm having trouble getting the navigation for phone and tablet views to look like the attached image. I'm assuming this could be resolved toward the bottom of the CSS code? Also, my page looks very wide compared to the photos in all views. I'm very much a novice at this if it isn't obvious.
body {
background-color: #b8dbed;
font-family: Arial;
}
header {
background-color: #000033;
color: #ffffff;
margin-left: auto;
margin-right: auto;
height: 120px;
padding-top: 30px;
padding-left: 3em;
text-align: center;
}
nav {
font-weight: bold;
padding: 1.5em;
font-size: 120%;
float: left;
width: 160px;
}
nav a {
text-decoration: none;
}
h1 {
margin-bottom: 0;
font-family: Georgia;
margin-top: 0;
font-size: 3em;
letter-spacing: 0.25em;
}
h2 {
color: #3399cc;
font-family: Georgia;
text-shadow: 1px 1px 1px #cccccc;
}
h3 {
font-family: Georgia;
color: #000033;
}
dt {
color: #000033;
}
.resort {
color: #5c7fa3;
font-weight: bold;
}
nav ul {
margin: 0;
padding-left: 0;
font-size: 1.2em;
}
main ul {
list-style-image: url(marker.gif);
}
footer {
font-size: 75%;
font-style: italic;
text-align: center;
font-family: Georgia;
padding: 20px;
margin-left: 190px;
background: #ffffff;
}
#contact {
font-size: 90%;
}
#wrapper {
width: 80%;
margin-left: auto;
margin-right: auto;
max-width: 960px;
min-width: 2048px;
background: #90c7e3;
box-shadow: 3px 3px 3px #333333;
border: 1px solid #000033;
background-image: linear-gradient(to bottom, #ffffff, #90c7e3);
}
main {
padding-top: 1px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
display: block;
background: #ffffff;
margin-left: 190px;
padding-left: 30px;
}
#homehero {
height: 300px;
background-image: url(coast2.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#trailhero {
height: 300px;
background-image: url(trail.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#yurthero {
height: 300px;
background-image: url(yurt.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
* {
box-sizing: border-box;
}
a:link {
color: #5c7fa3;
}
a:visited {
color: #344873;
}
a:hover {
color: #a52a2a;
}
header,
main,
nav,
footer,
figure,
figcaption,
aside,
section,
article {
display: block;
}
#mobile {
display: none;
}
#desktop {
display: inline;
}
#media only screen and (max-width: 64em) {
body {
background: #ffffff;
}
#wrapper {
min-width: 0;
width: auto;
box-shadow: none;
border: none;
}
header {
padding-top: 0.5em;
padding-bottom: 0.5em;
padding-left: 0;
height: auto;
}
h1 {
letter-spacing: 0.1em;
}
main {
margin-left: 0;
}
nav {
float: none;
width: auto;
text-align: center;
padding: 0.5em;
}
nav li {
display: inline;
padding-top: 0.25em;
padding-bottom: 0.25em;
padding-left: 0.75em;
padding-right: 0.75em;
}
#homehero {
margin-left: 0;
height: 200px;
}
#yurthero {
margin-left: 0;
height: 200px;
}
#trailhero {
margin-left: 0;
height: 200px;
}
footer {
margin-left: 0;
}
}
#media only screen and (max-width: 37.5em) {
main {
padding-top: 0.1em;
padding-bottom: 0.1em;
padding-right: 1em;
padding-left: 1em;
font-size: 90%;
}
h1 {
font-size: 2em;
}
nav {
padding: 0;
}
nav li {
display: block;
margin: 0;
border-bottom: 2px solid #330000;
}
nav a {
display: block;
}
#homehero {
background-image: none;
height: 0;
}
#yurthero {
background-image: none;
height: 0;
}
#trailhero {
background-image: none;
height: 0;
}
#mobile {
display: inline;
}
#desktop {
display: none;
}
}
<h1> Pacific Trails Resort </h1>
</header>
<nav>
<ul>
Home Yurts Activities Reservations
</ul>
</nav>
<div id="homehero">
</div>
<main>
<h2>Enjoy Nature in Luxury</h2>
<p> <span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast with panoramic views of the Pacific Ocean. Your stay at Pacific Trails Resort includes a sumptuously appointed private yurt and a cooked-to-order
breakfast each morning.</p>
<ul>
<li>Unwind in the heated outdoor pool and whirlpool</li>
<li>Explore the coast on your own or join our guided tours</li>
<li>Relax in our lodge while enjoying complimentary appetizers and beverages</li>
<li>Savor nightly fine dining with an ocean view</li>
</ul>
<br>
<div id="contact">
<span class="resort">Pacific Trails Resort</span> <br> 12010 Pacific Trails Road <br> Zephyr, CA 95555 <br>
<br>
<a id="mobile" href="tel:888-555-5555">888-555-5555</a> <br>
<span id="desktop">888-555-5555</span>
<br>
</div>
</main>
<footer>
Copyright © 2018 Pacific Trails Resort<br>
e.sween12#gmail.com
</footer>
</div>
Any help or guidance would be appreciated.
You were almost there. I found a few typos in your HTML code like the <header> not having an opening tag, along with semantic issues such as not using <li> elements in your unordered lists. After updating the HTML, all that was left was to provide a background color for the containers which hold the nav menu items at mobile and tablet viewport widths (ie the two media queries). I added a stock photo to the background-image for demonstration.
Lastly, updating your media queries to use px values instead of em. As #DCR mentioned, the em base value may change which in turn would cause your media queries to take affect at varying widths determined by the base value. Everything seems to match the desired output in the images you've included.
If you would like the page content to not exceed a certain viewport width, just specify max-width on the <body> and center it on the page with margin: 0 auto which creates 0 top/bottom margin and "auto" sized left/right margins to center the content. I also added a border and box-shadow to the body at "desktop size" so it matches your desired output.
body {
background-color: #b8dbed;
font-family: Arial;
max-width: 100ch; /* vary this */
margin: 0 auto 1rem auto;
border: .1rem solid #333;
box-shadow: 1px 2px 2px 0px #222;
}
header {
background-color: #000033;
color: #ffffff;
margin-left: auto;
margin-right: auto;
height: 120px;
padding-top: 30px;
padding-left: 3em;
text-align: center;
}
nav {
font-weight: bold;
padding: 1.5em;
font-size: 120%;
float: left;
width: 160px;
}
nav a {
text-decoration: none;
}
nav ul {
list-style-type: none;
}
h1 {
margin-bottom: 0;
font-family: Georgia;
margin-top: 0;
font-size: 3em;
letter-spacing: 0.25em;
}
h2 {
color: #3399cc;
font-family: Georgia;
text-shadow: 1px 1px 1px #cccccc;
}
h3 {
font-family: Georgia;
color: #000033;
}
dt {
color: #000033;
}
.resort {
color: #5c7fa3;
font-weight: bold;
}
nav ul {
margin: 0;
padding-left: 0;
font-size: 1.2em;
}
main ul {
list-style-image: url(marker.gif);
}
footer {
font-size: 75%;
font-style: italic;
text-align: center;
font-family: Georgia;
padding: 20px;
margin-left: 190px;
background: #ffffff;
}
#contact {
font-size: 90%;
}
#wrapper {
width: 80%;
margin-left: auto;
margin-right: auto;
max-width: 960px;
min-width: 2048px;
background: #90c7e3;
box-shadow: 3px 3px 3px #333333;
border: 1px solid #000033;
background-image: linear-gradient(to bottom, #ffffff, #90c7e3);
}
main {
padding-top: 1px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
display: block;
background: #ffffff;
margin-left: 190px;
padding-left: 30px;
}
#homehero {
height: 300px;
background-image: url(https://www.visitcalifornia.com/sites/visitcalifornia.com/files/NC_DuncansCove_Seeff_1280x642_sized_downsized.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#trailhero {
height: 300px;
background-image: url(trail.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#yurthero {
height: 300px;
background-image: url(yurt.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
* {
box-sizing: border-box;
}
a:link {
color: #5c7fa3;
}
a:visited {
color: #344873;
}
a:hover {
color: #a52a2a;
}
header,
main,
nav,
footer,
figure,
figcaption,
aside,
section,
article {
display: block;
}
#mobile {
display: none;
}
#desktop {
display: inline;
}
#media only screen and (max-width: 1024px) {
body {
background: #ffffff;
max-width: none;
border: none;
box-shadow: none;
}
#wrapper {
min-width: 0;
width: auto;
box-shadow: none;
border: none;
}
header {
padding-top: 0.5em;
padding-bottom: 0.5em;
padding-left: 0;
height: auto;
}
h1 {
letter-spacing: 0.1em;
}
main {
margin-left: 0;
}
nav {
float: none;
width: auto;
text-align: center;
padding: 0.5em;
background: rgba(213, 244, 250, .4);
}
nav li {
display: inline;
padding-top: 0.25em;
padding-bottom: 0.25em;
padding-left: 0.75em;
padding-right: 0.75em;
}
#homehero {
margin-left: 0;
height: 200px;
}
#yurthero {
margin-left: 0;
height: 200px;
}
#trailhero {
margin-left: 0;
height: 200px;
}
footer {
margin-left: 0;
}
}
#media only screen and (max-width: 600px) {
body {
box-shadow: none;
border: none;
}
main {
padding-top: 0.1em;
padding-bottom: 0.1em;
padding-right: 1em;
padding-left: 1em;
font-size: 90%;
}
h1 {
font-size: 2em;
}
nav {
padding: 0;
background: rgba(213, 244, 250, .4);
}
nav li {
display: block;
margin: 0;
border-bottom: 2px solid #330000;
}
nav a {
display: block;
}
#homehero {
background-image: none;
height: 0;
}
#yurthero {
background-image: none;
height: 0;
}
#trailhero {
background-image: none;
height: 0;
}
#mobile {
display: inline;
}
#desktop {
display: none;
}
}
<header>
<h1> Pacific Trails Resort </h1>
</header>
<nav>
<ul>
<li>Home
<li>Yurts</li>
<li>Activities</li>
<li>Reservations</li>
</ul>
</nav>
<div id="homehero">
</div>
<main>
<h2>Enjoy Nature in Luxury</h2>
<p> <span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast with panoramic views of the Pacific Ocean. Your stay at Pacific Trails Resort includes a sumptuously appointed private yurt and a cooked-to-order
breakfast each morning.</p>
<ul>
<li>Unwind in the heated outdoor pool and whirlpool</li>
<li>Explore the coast on your own or join our guided tours</li>
<li>Relax in our lodge while enjoying complimentary appetizers and beverages</li>
<li>Savor nightly fine dining with an ocean view</li>
</ul>
<br>
<div id="contact">
<span class="resort">Pacific Trails Resort</span> <br> 12010 Pacific Trails Road <br> Zephyr, CA 95555 <br>
<br>
<a id="mobile" href="tel:888-555-5555">888-555-5555</a> <br>
<span id="desktop">888-555-5555</span>
<br>
</div>
</main>
<footer>
Copyright © 2018 Pacific Trails Resort<br>
e.sween12#gmail.com
</footer>
</div>
I am trying to get the blue buttons to always stay lined up. Depending on the size of the screen and the text moving to multiple lines, it will cause the buttons to get out of alignment. Could I get help with how to get these to stay in line? http://marketing.geneia.com/himss2019/
Screenshot of buttons
#charset "utf-8";
/* CSS Document */
/* --------Resets-------- */
*{
margin:0;
padding:0;
border:0;
}
html, body {
margin: 0px;
padding: 0px;
border: 0px;
}
article, aside, details, figcaption, figure, footer, header, main, menu, nav, section, summary {
display: block;
}
body {
font-family: Averta-Regular, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
margin: 0 0 25px 0;
padding: 0;
font-family: Averta-Regular, sans-serif;
}
/* --------Styles-------- */
h1 {
font-size: 36px;
font-family: Averta-Extrabold, sans-serif;
font-weight: normal;
font-style: normal;
}
h2 {
font-size: 28px;
color: #125687;
font-family: Averta-Extrabold, sans-serif;
}
h2.smaller-blue {
font-size: 24px;
}
h3 {
font-size: 18px;
font-family: Averta-Semibold, sans-serif;
font-weight: normal;
line-height: 28px;
}
p, li {
color: #00354e;
font-size: 17px;
line-height: 30px;
}
ul {
list-style: none;
margin-bottom: 1.5rem;
}
li {
padding-left: 30px;
}
li:before {
content: "";
border-color: transparent #00aecb;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
display: block;
height: 0;
width: 0;
left: -1.2em;
top: 1.1em;
position: relative;
}
a {
position: relative;
display: inline-block;
transition: .3s;
text-decoration: none;
color: #00aecb;
}
a::after {
position: absolute;
bottom: .3em;
left: 0;
content: '';
width: 100%;
height: 1px;
background-color: #00adca;
opacity: 0;
transition: .3s;
}
a:hover::after {
bottom: 0;
opacity: 1;
color: #00adca;
}
a:hover {
color: #00adca;
text-decoration: none;
cursor: pointer;
}
b, strong, .bold {
font-weight: 700;
}
hr {
margin: 20px 0;
width: 100%;
border-top: 1px solid #cacfde;
}
.uppercase {
text-transform: uppercase;
}
.container, .container-fluid {
margin-right: auto;
margin-left: auto;
padding-left: 25px;
padding-right: 25px;
max-width: 1366px;
}
.uppercase {
text-transform: uppercase;
}
.vert-middle {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.green {
color: #a3d869;
}
.teal {
color: #00aecb;
}
.drk-blue {
color: #125687;
}
section.background-grey {
background: #eeeff2;
padding: 60px 20px;
}
section.background-white {
background: #fff;
padding: 60px 20px;
}
.center {
margin: 0 auto;
text-align: center;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.btn {
background-color: #4CAF50; /* Green */
border: none;
border-radius: 4px;
color: white;
font-family: Averta-Semibold;
font-weight: normal;
padding: 18px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px 2px;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
cursor: pointer;
}
a.btn:hover {
background-color: #42cfe6;
color: #fff;
}
a.btn::after {
display: none;
}
.btn-teal {
background-color: #00AECB;
}
a.btn.btn-teal:hover {
background-color: #42cfe6;
}
.btn-drkblue {
background-color: #0f5687;
}
a.btn.btn-drkblue:hover {
background-color: #0d3a5b;
}
a.anchor-link {
display: block;
}
a.anchor-link::after {
display: none;
}
a.link-image::after {
display: none;
}
/* --------Header/Top Nav-------- */
header {
background-color: #fff;
height: 100px;
width: 100%;
}
.logo {
padding: 15px 0;
}
nav {
padding: 40px 0;
float: right;
}
nav ul {
list-style-type: none;
text-align: right;
float: right;
margin: 0;
padding: 0;
}
nav li {
display: inline;
padding: 2px;
color: #005d91;
font-size: 16px;
}
nav li:before {
display: none;
}
nav a:hover {
color: #00aecb;
}
/* --------Hero-------- */
.hero {
position: relative;
padding: 125px 0 125px 0;
background: url(img/lp-hero-1.jpg) no-repeat;
background-size:cover;
background-position: center 20%;
color: #fff;
}
.hero.subscribe {
position: relative;
padding: 125px 0 125px 0;
background: url(img/lp-hero-2.jpg) no-repeat;
background-size:cover;
background-position: center 20%;
color: #fff;
}
.hero.sessions {
position: relative;
padding: 125px 0 125px 0;
background: url(img/lp-hero-3.jpg) no-repeat;
background-size:cover;
background-position: center 20%;
color: #fff;
}
.hero h1 {
font-size: 48px;
margin-top: 10px;
}
.mobile h1 {
color: #125687;
font-weight: 400;
font-size: 28px;
}
.mobile p {
font-size: 14px;
line-height: 24px;
}
.subtitle {
font-size: 18px;
font-weight: 700;
text-transform: uppercase;
margin-bottom: 10px;
letter-spacing: .1em;
color: #fff;
background: #73ca14;
padding: 10px 15px;
display: inline-block;
}
.hero-text p {
color: #fff;
}
.hero-text h3 {
/*color: #a3d06a;*/
}
/* --------Main Content-------- */
.main-content--text {
padding-right: 40px;
width: 60%;
}
img.pdf-thumb {
width: 225px;
margin: -30px 0 0 0;
-ms-transform: rotate(6deg);
-webkit-transform: rotate(6deg);
transform: rotate(6deg);
}
p.intro-text {
font-size: 22px;
line-height: 30px;
color: #125687;
}
.cta-callout {
background: rgba(255, 255, 255, 0.7); /* White background with 70% opacity */
padding: 25px;
margin: 0 0 20px 0;
}
.cta-callout p{
margin-bottom: 0;
}
p.subhead {
margin: 30px 0 5px 0;
color: #125687;
}
.col-lg-7.main-text {padding: 0 10px 0 50px;}
/* --------Form-------- */
form {
margin-top: 25px;
padding: 0 30px 30px;
}
input[type=text], select {
width: 100%;
padding: 8px;
margin: 0 0 10px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 15px;
}
input[type=submit] {
background-color: #00aecb;
color: white;
padding: 14px 40px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
-webkit-transition: background-color .5s ease-out;
-moz-transition: background-color .5s ease-out;
-o-transition: background-color .5s ease-out;
transition: background-color .5s ease-out;
}
input[type=submit]:hover {
background-color: #125687;
}
label {
color: #5e5f60;
margin-bottom: 0;
font-size: 14px;
font-weight: 700;
}
.download-form {
background: #fff;
padding: 0;
}
.download-form h3 {
color: #fff;
font-size: 20px;
font-weight: 500;
}
.form-header {
background: #125687;
padding: 30px 20px;
text-align: center;
}
textarea,
input.text,
input[type="text"],
input[type="button"],
input[type="submit"],
.input-checkbox {
-webkit-appearance: none;
border-radius: 0;
}
/* --------Value Prop Content-------- */
.valueprop {
padding: 10px 30px;
}
.valueprop:nth-child(n+2) {
border-left: 1px solid #ebebeb;
}
.valueprop p {
text-align: center;
font-size: 15px;
line-height: 25px;
}
.valueprop h3 {
color: #00aecb;
text-transform: uppercase;
margin-bottom: 20px;
margin-top: 1.5em;
}
.valueprop-content h2 {
margin-bottom: 50px;
}
section.background-white.valueprop-content {
padding: 60px 20px;
}
section.background-white.valueprop-content h3 {
color: #00aecb;
text-transform: uppercase;
margin-bottom: 20px;
margin-top: 1.5em;
font-family: Averta-Bold, sans-serif;
}
.verticalLine {
border-left: 1px solid red;
}
/* --------Events-------- */
section.events {
padding: 60px 0;
}
.thead-blue {
background-color: #00aecc;
color: #fff;
}
/* --------Footer-------- */
.container-fluid--footer {
margin-right: auto;
margin-left: auto;
padding-left: 25px;
padding-right: 25px;
max-width: 800px;
}
.page-footer {
background-color: #125687;
bottom: 0;
margin: 0;
padding: 60px 0;
}
.footer-info {
display: inline;
}
.footer-1 {
text-align: center;
}
.footer-2 {
text-align: center;
}
.footer-1 h3, .footer-2 h3,
.footer-1 p, .footer-2 p,
.footer-1 a, .footer-2 a {
color: #fff;
}
.footer-nav {
padding-top: 60px;
text-align: center;
margin: 0 auto;
}
.footer-nav ul {
list-style-type: none;
text-align: center;
margin: 0;
padding: 0;
}
.footer-nav li {
display: inline;
padding: 0;
font-size: 14px;
}
.footer-nav li:before {
display: none;
}
.footer-nav li:after {
content: "|";
color: #a7a298;
padding: 0 10px;
}
.footer-nav li:nth-last-child(1):after {
display: none;
}
.footer-nav a {
color: #fff;
}
.copyright {
font-size: 14px;
padding-top: 15px;
margin: 0;
color: #fff;
}
/* --------Font Awesome Styles-------- */
#font-face {
font-family: 'FontAwesome';
src: url('fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fa-twitter-square:before {
content: "\f081";
}
.fa-rss-square:before {
content: "\f143";
}
.fa-linkedin-square:before {
content: "\f08c";
}
i.fa.fa-rss-square, i.fa.fa-linkedin-square, i.fa-twitter-square, i.fa-facebook-square {
font-size: 20px;
color: #00aecb;
}
.fa-facebook-square:before {
content: "\f082";
}
i.fa:hover {
color: #125687;
}
a.social-icon::after {
background-color: #fff !important;
content: none;
}
/* --------Media Queries-------- */
#media (max-width: 1024px){
input[type=submit] {padding: 14px 25px;}
h1 {font-size: 32px;}
.hero h1 {font-size: 38px;}
h2 {font-size: 25px;}
}
#media (min-width: 901px) {
section.main-content>div.container-fluid {
display: flex;
flex-direction: row-reverse;
}
}
#media (max-width: 991px){
img.img-responsive.text-img {padding: 0 0 20px 0;}
.col-lg-7.main-text {padding: 0 20px;}
}
#media (max-width: 900px){
input[type=submit] {padding: 14px 40px;}
section.background-grey {
padding: 40px 0 30px 0;
}
.main-content--text {
padding: 0;
width: 100%;
}
h1 {font-size: 30px;}
.subtitle {
font-size: 16px;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #007caa;
opacity: 0.6;
}
.col-sm-6.hero-text {
flex: 80%;
max-width: 80%;
}
}
#media (max-width: 767px){
.valueprop:nth-child(n+2) {
border-left: none;
}
.hero, .hero.sessions, .hero.subscribe {
padding: 80px 0 70px 0;
}
img.pdf-thumb {
width: 200px;
margin: -20px 0 0 0;
}
}
#media (max-width: 580px){
.hero, .hero.sessions, .hero.subscribe {padding: 48px 0 38px 0}
nav li {
padding: 0 3px;
}
header {
height: inherit;
}
.col-sm-6.hero-text {
flex: 100%;
max-width: 100%;
}
header .container-fluid {
text-align: center;
}
nav {
padding: 10px 0 20px 0;
float: none;
}
nav ul {
float: none;
text-align: center;
}
.logo {
width: 65%;
padding: 15px 0 0;
}
.hero h1 {font-size: 26px;}
.hero h3 {font-size: 16px;}
h1 {font-size: 26px;}
.subtitle {
font-size: 14px;
}
.btn {
width: 100%;
}
h2 {font-size: 22px;}
section.background-grey, section.background-white, section.events {padding: 30px 0 20px 0;}
section.background-white.valueprop-content {padding: 40px 20px;}
input[type=submit] {padding: 14px 25px;}
form {padding: 0 20px 30px;}
.download-form h3 {font-size: 16px;}
img.pdf-thumb {
width: 150px;
margin: -10px 0 0 0;
}
}
#media (max-width: 460px){
img.pdf-thumb {
width: 150px;
margin: 10px 0 0 0;
}
}
#media (max-width: 360px){
.hero {
/*background: url(img/hero-1-xsm.jpg) no-repeat;
background-size: cover;*/
}
}
#media (max-width: 320px){
.container, .container-fluid {
padding-left: 20px;
padding-right: 20px;
}
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<section class="background-white valueprop-content">
<div class="container-fluid">
<div class="center">
<div class="row">
<div class="col-lg-3 valueprop">
<img class="valueprop-icon" src="img/session-icon.png" alt="session icon" style="max-width: 100%; height: auto;" />
<h3>Explore sessions</h3>
<p>Tour Geneia’s educational sessions which include topics such as AI, machine learning and SDoH.</p>
<a class="btn btn-teal" href="explore-sessions.html" target="_blank">View sessions </a>
</div>
<hr class="d-block d-lg-none">
<div class="col-lg-3 valueprop">
<img class="valueprop-icon" src="img/meeting-icon.png" alt="meeting icon" style="max-width: 100%; height: auto;" />
<h3>Schedule a meeting</h3>
<p>Request a meeting with on-site experts to learn more about our offerings and views demos.</p>
<a class="btn btn-teal" href="mailto:geneia#geneia.com?subject=Schedule a meeting at HIMSS" target="_blank">Request a meeting</a></div>
<hr class="d-block d-lg-none">
<div class="col-lg-3 valueprop">
<img class="valueprop-icon" src="img/email-icon.png" alt="email icon" style="max-width: 100%; height: auto;" />
<h3>Connect with us</h3>
<p>Stay up-to-date on our activities, including HIMSS19</p>
<br class="d-none d-sm-block">
<a class="btn btn-teal" href="form.html" target="_blank">Sign up</a>
</div>
<hr class="d-block d-lg-none">
<div class="col-lg-3 valueprop">
<img class="valueprop-icon" src="img/find-icon.png" alt="find icon" style="max-width: 100%; height: auto;" />
<h3>Find us at HIMSS</h3>
<p>Explore our solutions and services at booth 541 in the exhibit hall.</p>
<br class="d-none d-sm-block">
<a class="btn btn-teal" href="https://himss19.mapyourshow.com/7_0/floorplan/index.cfm?hallID=S&selectedBooth=booth~541" target="_blank">Locate our booth</a>
</div>
</div>
</div>
</div>
</section>
Use Flexbox to evenly distribute the items in the div.
.col-lg-3 {
display: flex;
flex-direction: column;
justify-content: space-between;
}
The problem is the about section. I want the home_about_box to be on-top of a background image. Here is a quick sketch:
I am very new to this, so if you have the fix, I would appreciate both getting the code, and a good explanation on what I have done wrong.
Thanks, and don´t be shy to criticise my code, as long as it´s constructive criticism!
#import url('https://fonts.googleapis.com/css?family=Lato:300,400,700,900');
* {
box-sizing: border-box;
transition: all ease-in-out 250ms;
}
body {
margin: 0;
font-family: "Lato", sans-serif;
text-align: center;
}
img {
max-width: 100%;
height: auto;
padding: 1em 0 1em;
background-size: cover;
}
.container {
width: 100%;
margin: 0 auto;
}
/* Header
========= */
header {
position: absolute;
width: 100%;
}
nav ul {
margin: 0;
padding: 1em 0;
list-style: none;
}
nav li {
display: inline-block;
margin: .5em
}
nav a {
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
font-size: .9rem;
padding: .5em;
color: #FFF;
}
nav a:hover,
nav a:focus {
color: #DDD;
}
#media (min-width: 60rem) {
.logo {
float: left;
text-align: center;
align-content: center;
}
nav {
float: right;
text-align: center;
margin-right: 1em;
}
}
/* Buttons
========== */
.button_top {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #174FC1;
padding: .5em 1em;
color: #FFF;
}
.button_top:hover,
.button_top:focus {
background: #174FC1;
color: #FFF;
}
.button_dark {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #FFF;
padding: .5em 1em;
color: #FFF;
margin-bottom: 1em;
}
.button_dark:hover,
.button_dark:focus {
background: #FFF;
color: #000;
}
#media (min-width: 25rem) {
.button_top {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_top {
font-size: 2.4rem;
padding: .3em 1em;
margin-top: -1em;
}
}
#media (min-width: 25rem) {
.button_dark {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_dark {
font-size: 2rem;
padding: .3em 1em;
}
}
.clearfix::after,
section::after,
footer::after {
content: "";
display: block;
clear: both;
}
/* Typography
========= */
.title {
font-size: 2rem;
margin-bottom: 1.6em;
margin-top: 5em;
}
.title span {
font-weight: 300;
display: block;
font-size: 1.3rem;
}
.title-cta {
margin: 0 0 1em;
}
#media (min-width: 60rem) {
.title {
font-size: 4rem;
margin-top: 1.5em;
}
}
h1 {
font-weight: 800;
margin-top: 0;
}
.unstyled-list {
margin: 0;
padding: 1.3em;
list-style-type: none;
text-align: left;
}
/* Home.hero
========= */
.home-hero {
background-image: url(https://i.imgur.com/yUFKqAe.jpg);
background-size: cover;
background-position: center;
padding: 1em;
color: #FFF;
width: 100%;
height: 100vh;
}
#media (min-width: 25rem) {
.home-hero {
width: 100%;
height: 100vh;
}
}
#media (min-width: 60rem) {
.home-hero {
width: 100%;
height: auto;
}
}
#media (min-height: 30rem) {
.home-hero {
width: 100%;
height: 100vh;
}
}
/*Home About */
.home_about_box {
background-color: #232323;
font-size: .8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #FFF;
position: relative
}
.home_about_box h1 {
color: #174fc1;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 1.3em;
background: #232323;
padding: 0 0.5em
}
#media (min-width: 25rem) {
h1 {
font-size: 1.6rem;
}
.home_about_box h1 {
top: 1.3rem;
}
}
#media (min-width: 60rem) {
h1 {
font-size: 1.2rem;
}
.about.bg {
background-image: url(https://i.imgur.com/aTF2hwR.jpg);
padding: 5em;
}
.home_about_box {
background-color: #232323;
font-size: 0.8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #fff;
z-index: 101;
width: 25em;
margin-left: 52em;
}
.home_about_box h1 {
top: 1.5rem;
}
}
/* portfolio
*/
.portfolio_home {
margin: 1.8em 0 0;
background-size: cover;
}
.portfolio_home h1 {
color: #174FC1;
font-size: 3em;
margin: auto;
padding: 0 0 .3em 0;
}
.port-item {
margin: 0;
position: relative;
}
.port-item img {
display: block;
}
.port-desc {
position: absolute;
z-index: 100;
bottom: 0em;
left: 0em;
right: 0em;
color: #FFF;
background: rgba(0, 0, 0, .75);
padding-bottom: 1em;
padding-top: 1em;
}
.port-desc p {
margin: .5em;
background-size: 100% 100%;
}
#media (min-width: 40rem) {
.port-item {
width: 50%;
float: left;
}
}
#media (min-width: 60rem) {
.port-item {
width: 33.3333334%;
float: left;
overflow: hidden
}
.port-desc {
transform: translateY(150%);
}
.port-item:hover .port-desc {
transform: translateY(0%)
}
.port-item img {
max-width: 100%;
height: auto;
padding: 0 0 0;
background-size: cover;
}
}
/* CTA
*/
.cta {
background-color: #174fc1;
padding: 0.1em;
}
.cta h1 {
margin-top: 1em;
color: #FFF
}
/* Footer */
footer {
background: #232323;
color: #FFF;
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tobias Barsnes</title>
<link href="home.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 900, function() {
window.location.hash = hash;
});
}
});
});
</script>
</head>
<body>
<header>
<img class="logo" src="https://i.imgur.com/o3Mmqvq.png" width="100" height="89" alt="">
<nav>
<ul>
<li>Home</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</nav>
</header>
<section class="home-hero">
<div class="container">
<h1 class="title">Tobias Barsnes
<span>Portfolio</span>
</h1>
Take a look
</div>
</section>
<section class="home.about">
<div class="about.bg">
<div class="home_about_box">
<h1>About Myself</h1>
<p>I am a 16 year old boy from Norway. My whole life I have been interested in graphical design, and I am currently studying "Medium and Communications".</p>
<p>A big goal for me is to get a job that has to do with graphical design. I have experience dating all the way back to 2012, but I am still in the "learning phase".</p>
</div>
</div>
</section>
<section class="portfolio_home" id="portfolio">
<h1>Some of my work</h1>
<figure class="port-item">
<!-- Portfolio 1 -->
<img src="https://i.imgur.com/eBRYWII.png" alt="portfolio item" />
<figcaption class="port-desc">
<p>Geofilters</p>
</figcaption>
</figure>
<!-- Portfolio 2 -->
<figure class="port-item">
<img src="https://i.imgur.com/gAfgliA.png" alt="portfolio item" />
<figcaption class="port-desc">
<p>Quixz eSports</p>
</figcaption>
</figure>
<!-- Portfolio 3 -->
<figure class="port-item">
<img src="https://i.imgur.com/IjoGmUT.png" alt="portfolio item" />
<figcaption class="port-desc">
<p>3D Renders</p>
</figcaption>
</figure>
<!-- Portfolio 4 -->
<figure class="port-item">
<img src="https://i.imgur.com/4zymXa8.png" alt="portfolio item" />
<figcaption class="port-desc">
<p>Backgrounds</p>
</figcaption>
</figure>
</section>
<section class="cta">
<div class="container">
<h1 class="title title-cta">Want to see more?
<span>Then what are you waiting for?</span>
</h1>
See More
</div>
</section>
<footer>
<section class="home-foot">
<ul class="unstyled-list">
<li> <strong>Website crafted by Tobias Barsnes</strong></li>
</ul>
</section>
</footer>
</body>
</html>
you just need to change this line
<div class="about.bg">
to this
<div class="about bg">
and it will work,
Note:
<div class="class1.text"></div>
is incorrect syntax, you can write it like this
<div class="class1-text"></div>
if u apply your css like
.class1.text{}
it means you have 2 classes in a div and u want to select them like
my above selector will select this element
check below code in full preview mode
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tobias Barsnes</title>
<style>
#import
url('https://fonts.googleapis.com/css?family=Lato:300,400,700,900');
* {
box-sizing: border-box;
transition: all ease-in-out 250ms;
}
body {
margin: 0;
font-family: "Lato", sans-serif;
text-align: center;
}
img {
max-width: 100%;
height: auto;
padding: 1em 0 1em;
background-size: cover;
}
.container {
width: 100%;
margin: 0 auto;
}
/* Header
========= */
header {
position: absolute;
width: 100%;
}
nav ul {
margin: 0;
padding: 1em 0;
list-style: none;
}
nav li {
display: inline-block;
margin: .5em
}
nav a {
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
font-size: .9rem;
padding: .5em;
color: #FFF;
}
nav a:hover,
nav a:focus{
color: #DDD;
}
#media (min-width: 60rem) {
.logo{
float: left;
text-align: center;
align-content: center;
}
nav{
float: right;
text-align: center;
margin-right: 1em;
}
}
/* Buttons
========== */
.button_top {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #174FC1;
padding: .5em 1em;
color: #FFF;
}
.button_top:hover,
.button_top:focus {
background: #174FC1;
color: #FFF;
}
.button_dark {
display: inline-block;
font-size: 1.3rem;
text-decoration: none;
text-transform: uppercase;
border-width: 2px;
border-style: solid;
border-color: #FFF;
padding: .5em 1em;
color: #FFF;
margin-bottom: 1em;
}
.button_dark:hover,
.button_dark:focus {
background: #FFF;
color: #000;
}
#media (min-width: 25rem) {
.button_top {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_top {
font-size: 2.4rem;
padding: .3em 1em;
margin-top: -1em;
}
}
#media (min-width: 25rem) {
.button_dark {
font-size: 1.7rem;
padding: .3em 1em
}
}
#media (min-width: 60rem) {
.button_dark {
font-size: 2rem;
padding: .3em 1em;
}
}
.clearfix::after,
section::after,
footer::after{
content: "";
display: block;
clear: both;
}
/* Typography
========= */
.title {
font-size: 2rem;
margin-bottom: 1.6em;
margin-top: 5em;
}
.title span {
font-weight: 300;
display: block;
font-size: 1.3rem;
}
.title-cta {
margin: 0 0 1em;
}
#media (min-width: 60rem) {
.title{
font-size: 4rem;
margin-top: 1.5em;
}
}
h1 {
font-weight: 800;
margin-top: 0;
}
.unstyled-list {
margin: 0;
padding: 1.3em;
list-style-type: none;
text-align: left;
}
/* Home.hero
========= */
.home-hero {
background-image: url(https://i.imgur.com/yUFKqAe.jpg);
background-size: cover;
background-position: center;
padding: 1em;
color: #FFF;
width: 100%;
height: 100vh;
}
#media (min-width: 25rem) {
.home-hero{
width: 100%;
height: 100vh;
}
}
#media (min-width: 60rem) {
.home-hero{
width: 100%;
height: auto;
}
}
#media (min-height: 30rem) {
.home-hero{
width: 100%;
height: 100vh;
}
}
/*Home About */
.home_about_box {
background-color: #232323;
font-size: .8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #FFF;
position: relative
}
.home_about_box h1 {
color: #174fc1;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 1.3em;
background: #232323;
padding: 0 0.5em
}
#media (min-width: 25rem) {
h1 {
font-size: 1.6rem;
}
.home_about_box h1 {
top: 1.3rem;
}
}
#media (min-width: 60rem) {
h1 {
font-size: 1.2rem;
}
.about.bg {
background-image: url(https://i.imgur.com/aTF2hwR.jpg);
padding: 5em;
}
.home_about_box {
background-color: #232323;
font-size: 0.8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #fff;
z-index: 101;
width: 25em;
margin-left: 52em;
}
.home_about_box h1 {
top: 1.5rem;
}
}
/* portfolio
*/
.portfolio_home {
margin: 1.8em 0 0;
background-size: cover;
}
.portfolio_home h1 {
color: #174FC1;
font-size: 3em;
margin: auto;
padding: 0 0 .3em 0;
}
.port-item {
margin: 0;
position: relative;
}
.port-item img {
display: block;
}
.port-desc {
position: absolute;
z-index: 100;
bottom: 0em;
left: 0em;
right: 0em;
color: #FFF;
background: rgba(0,0,0,.75);
padding-bottom: 1em;
padding-top: 1em;
}
.port-desc p {
margin: .5em;
background-size: 100% 100%;
}
#media (min-width: 40rem) {
.port-item {
width: 50%;
float: left;
}
}
#media (min-width: 60rem) {
.port-item {
width: 33.3333334%;
float: left;
overflow: hidden
}
.port-desc {
transform: translateY(150%);
}
.port-item:hover .port-desc {
transform: translateY(0%)
}
.port-item img {
max-width: 100%;
height: auto;
padding: 0 0 0;
background-size: cover;
}
}
/* CTA
*/
.cta{
background-color: #174fc1;
padding: 0.1em;
}
.cta h1 {
margin-top: 1em;
color: #FFF
}
/* Footer */
footer {
background: #232323;
color: #FFF;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 900, function(){
window.location.hash = hash;
});
}
});
});
</script>
</head>
<body>
<header>
<img class="logo" src="https://i.imgur.com/o3Mmqvq.png" width="100" height="89" alt="">
<nav>
<ul>
<li>Home</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</nav>
</header>
<section class="home-hero">
<div class="container">
<h1 class="title">Tobias Barsnes
<span>Portfolio</span>
</h1>
Take a look
</div>
</section>
<section class="home.about">
<div class="about bg">
<div class="home_about_box">
<h1>About Myself</h1>
<p>I am a 16 year old boy from Norway. My whole life I have been interested in graphical design, and I am currently studying "Medium and Communications".</p>
<p>A big goal for me is to get a job that has to do with graphical design. I have experience dating all the way back to 2012, but I am still in the "learning phase".</p>
</div>
</div>
</section>
<section class="portfolio_home" id="portfolio">
<h1>Some of my work</h1>
<figure class="port-item">
<!-- Portfolio 1 -->
<img src="https://i.imgur.com/eBRYWII.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Geofilters</p>
</figcaption>
</figure>
<!-- Portfolio 2 -->
<figure class="port-item">
<img src="https://i.imgur.com/gAfgliA.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Quixz eSports</p>
</figcaption>
</figure>
<!-- Portfolio 3 -->
<figure class="port-item">
<img src="https://i.imgur.com/IjoGmUT.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>3D Renders</p>
</figcaption>
</figure>
<!-- Portfolio 4 -->
<figure class="port-item">
<img src="https://i.imgur.com/4zymXa8.png" alt="portfolio item"/>
<figcaption class="port-desc">
<p>Backgrounds</p>
</figcaption>
</figure>
</section>
<section class="cta">
<div class="container">
<h1 class="title title-cta">Want to see more?
<span>Then what are you waiting for?</span>
</h1>
See More
</div>
</section>
<footer>
<section class="home-foot">
<ul class="unstyled-list">
<li> <strong>Website crafted by Tobias Barsnes</strong></li>
</ul>
</section>
</footer>
</body>
</html>
I'm not sure if this is what you want but try this CSS code:
.home_about_box {
background-color: transparent;
font-size: .8em;
padding: 4em;
outline: 2px solid #174fc1;
outline-offset: -3em;
color: #FFF;
position: absolute;
z-index:500;
margin-top:-25%;
;
}
Here's a fiddle: https://jsfiddle.net/er8qhrhL/
I am trying to make a bottom sidebar with social media icons using float and clear properties. All of the icons are floated left, except for the twitter icon which is clearright. Why is the icon for twitter larger than the other icons? However, it is the same size when it's floated left.
I'd like for it to be the same size as the other icons and stay in that far right corner position. Or at least be centered without a lot of space in between the icons... How do I fix this? What am I doing wrong?
#import url('https://fonts.googleapis.com/css?family=Open+Sans|Poppins');
html {
font-size: 1em;
}
body {
background-color: white;
font-family: 'Open Sans', sans-serif;
}
/*logo*/
#logo {
float: left;
width: 5.5em;
background-color: white;
position: relative;
top: -2em;
}
/*pagewrapper*/
.pageWrapper {
width: 1000px;
margin: 0 auto;
padding: 2em;
margin-top: 1.5em;
margin-bottom: 1.5em;
border-style: double;
border-width: thick;
border-color: #7BDFF2;
overflow: auto;
}
/*menu*/
#nav_menu ul {
list-style-type: none;
}
#nav_menu ul li {
float: left;
margin-left: 6em;
margin-right: 4em;
}
#nav_menu li a {
text-align: center;
display: block;
width: 9em;
padding: .9em 0;
text-decoration: none;
background-color: #7BDFF2;
color: #eff7f6;
font-weight: bold;
border-radius: 1em;
}
#nav_menu li a:hover {
color: #f7d6e0;
}
#nav_menu li a:active {
color: #b2f7ef;
}
a {
text-transform: uppercase;
font-weight: bold;
color: #f2b5d4;
}
a:active {
color: #ffcdee;
}
a:hover {
color: #eff7f6;
}
/*copyright*/
footer {
text-align: center;
font-weight: 100;
font-size: .7em;
}
/* aside */
#socialmedia {
width: 80%;
margin: 0 auto;
margin-top: 2em;
}
#socialmedia h3 {
text-transform: lowercase;
color: #fff;
margin: 0 auto;
background-color: #f2b5d4;
letter-spacing: .9em;
font-size: .8em;
width: 100%;
height: 100%;
border-style: dotted;
border-color: #eff7f6;
text-align: center;
border-width: thin;
}
#socialmedia img {
width: 10%;
height: auto;
}
/*youtube embed video*/
.video iframe,
.video object,
.video embed {
display: block;
margin: 0 auto;
top: 0;
left: 0;
padding-top: 1em;
clear: both;
}
h1 {
font-weight: bold;
text-align: center;
font-size: 2em;
position: relative;
right: .5em;
bottom: -2em;
}
h2 {
font-weight: 200;
text-align: left;
}
.member {
margin-top: 3em;
}
.p album {
margin-top: .3em;
}
/*albums*/
.album {
border: dotted #000 .2em;
border-radius: .5em;
width: 20em;
min-height: 20em;
font-size: 1em;
margin-top: 5em;
margin: 1em;
padding: 1em;
}
#album img {
height: auto;
max-width: 100%;
}
/*floats and clears*/
.left {
float: left;
}
.right {
float: right;
}
.clearleft {
clear: left;
}
.clearright {
clear: right;
}
.clearboth {
clear: both;
}
<aside id="socialmedia">
<h3>social media</h3>
<div class="ig left">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2016/240/iconmonstr-instagram-13.png" alt="instagram logo">
</div>
<div class="fb left">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2012/240/iconmonstr-facebook-3.png" alt="facebook logo">
</div>
<div class="yt left">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2013/240/iconmonstr-youtube-8.png" alt="youtube logo">
</div>
<div class="twt clearright">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2012/240/iconmonstr-twitter-3.png" alt="twitter logo">
</div>
</aside>
You can make them 10% wide with 20% margin between the first three. 10% x 4 = 40%. 20% * 3 = 60%. 40% + 60% = 100%
#import url('https://fonts.googleapis.com/css?family=Open+Sans|Poppins');
html {
font-size: 1em;
}
body {
background-color: white;
font-family: 'Open Sans', sans-serif;
}
/*logo*/
#logo {
float: left;
width: 5.5em;
background-color: white;
position: relative;
top: -2em;
}
/*pagewrapper*/
.pageWrapper {
width: 1000px;
margin: 0 auto;
padding: 2em;
margin-top: 1.5em;
margin-bottom: 1.5em;
border-style: double;
border-width: thick;
border-color: #7BDFF2;
overflow: auto;
}
/*menu*/
#nav_menu ul {
list-style-type: none;
}
#nav_menu ul li {
float: left;
margin-left: 6em;
margin-right: 4em;
}
#nav_menu li a {
text-align: center;
display: block;
width: 9em;
padding: .9em 0;
text-decoration: none;
background-color: #7BDFF2;
color: #eff7f6;
font-weight: bold;
border-radius: 1em;
}
#nav_menu li a:hover {
color: #f7d6e0;
}
#nav_menu li a:active {
color: #b2f7ef;
}
a {
text-transform: uppercase;
font-weight: bold;
color: #f2b5d4;
}
a:active {
color: #ffcdee;
}
a:hover {
color: #eff7f6;
}
/*copyright*/
footer {
text-align: center;
font-weight: 100;
font-size: .7em;
}
/* aside */
#socialmedia {
width: 80%;
margin: 0 auto;
margin-top: 2em;
}
#socialmedia h3 {
text-transform: lowercase;
color: #fff;
margin: 0 auto;
background-color: #f2b5d4;
letter-spacing: .9em;
font-size: .8em;
width: 100%;
height: 100%;
border-style: dotted;
border-color: #eff7f6;
text-align: center;
border-width: thin;
}
#socialmedia img {
max-width: 100%;
height: auto;
}
/*youtube embed video*/
.video iframe,
.video object,
.video embed {
display: block;
margin: 0 auto;
top: 0;
left: 0;
padding-top: 1em;
clear: both;
}
h1 {
font-weight: bold;
text-align: center;
font-size: 2em;
position: relative;
right: .5em;
bottom: -2em;
}
h2 {
font-weight: 200;
text-align: left;
}
.member {
margin-top: 3em;
}
.p album {
margin-top: .3em;
}
/*albums*/
.album {
border: dotted #000 .2em;
border-radius: .5em;
width: 20em;
min-height: 20em;
font-size: 1em;
margin-top: 5em;
margin: 1em;
padding: 1em;
}
#album img {
height: auto;
max-width: 100%;
}
/*floats and clears*/
.left {
float: left;
}
.right {
float: right;
}
.clearleft {
clear: left;
}
.clearright {
clear: right;
}
.clearboth {
clear: both;
}
.icons:last-child {
justify-content: center;
}
#socialmedia > div {
float: left;
width: 10%;
}
#socialmedia > div:not(:last-child) {
margin-right: 20%;
}
<aside id="socialmedia">
<h3>social media</h3>
<div class="ig">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2016/240/iconmonstr-instagram-13.png" alt="instagram logo">
</div>
<div class="fb">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2012/240/iconmonstr-facebook-3.png" alt="facebook logo">
</div>
<div class="yt">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2013/240/iconmonstr-youtube-8.png" alt="youtube logo">
</div>
<div class="twt">
<img src="https://cdns.iconmonstr.com/wp-content/assets/preview/2012/240/iconmonstr-twitter-3.png" alt="twitter logo">
</div>
</aside>
Please could somebody help me with flex for pushing my footer down / expanding the content to fit?
https://jsfiddle.net/9xjy78gj/
Hopefully it's clear to see from the site what my issue is.
I'd just like to use flex to push the footer down and expand the content div appropriately, without using set heights for the content div etc. if possible?
Many thanks!
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="page_wrap">
<header>
<a href="/">
<h1>Close<span><i class="fa fa-map-marker" aria-hidden="true"></i></span>Range</h1>
</a>
<hr />
</header>
<div id="refinement">
<form>
<div class="form_component">
<select id="narrow">
<option value="select" selected disabled>Please Select</option>
</select>
</div>
<div class="form_component">
<input id="driving" type="radio" name="travelmode" value="Driving" checked /> <i class="fa fa-car" aria-hidden="true"></i>
</div>
<div class="form_component">
<input id="walking" type="radio" name="travelmode" value="Walking" /> <i class="fa fa-male" aria-hidden="true"></i>
</div>
</form>
</div>
<div id="jquery_placeholder">
<!-- JQuery loads PHP output into here-->
</div>
<div id="place_results_wrap">
<!-- and here -->
<div id="content">
<h2>Let's explore!</h2>
<i class="fa fa-globe" aria-hidden="true"></i>
</div>
</div>
<footer class="footer">
<div id="google">
<img src="/assets/i/google.png" alt="Powered by Google" />
</div>
</footer>
</div>
</body>
</html>
CSS
a, a:hover
{
text-decoration: none;
}
body
{
font-family: 'Open Sans', sans-serif;
background: #ECECEA;
font-size:16px;
}
#page_wrap
{
width:100%;
}
header
{
background: #fff;
text-align: center;
padding: 1.250em;
}
header h1
{
font-size: 6em;
font-weight: 400;
color: #655e5e;
margin: 0;
display: inline-block;
}
#media screen and (max-width: 550px)
{
header h1 {
font-size: 3em;
}
}
header hr
{
max-width: 36em;
margin-bottom: 0px;
}
header .fa-map-marker
{
color: #ec3b3b;
font-size: 1.2em;
}
#refinement
{
padding: 0.5em 1.25em 1.25em;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
#refinement form
{
display: flex;
justify-content: center;
}
.form_component
{
margin: 0 0.4em;
display: none;
}
.form_component i.fa
{
font-size: 1.4em;
color: #655e5e;
}
#content
{
text-align: center;
background: #655e5e;
padding: 1.25em;
}
#content h2
{
color: #fff;
font-weight: 400;
font-size: 4em;
margin: 0;
}
#media screen and (max-width: 415px) {
#content h2
{
font-size:2em;
}
}
#content i.fa-globe
{
font-size: 18em;
color: #fff;
}
.place_results
{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 1.25em 0;
}
.next_page
{
padding: 0 1.250em;
width: 100%;
text-align: center;
}
.next_page button
{
background-color: #fff;
border: none;
color: #655e5e;
padding: 0.3125em 2em;
text-decoration: none;
display: inline-block;
font-size: 1em;
font-weight: 600;
cursor: pointer;
border-radius: 1.25em;
}
.next_page button:hover
{
background-color: #f6f6f6;
}
.place
{
width: 24em;
height: 27em;
margin: 1.25em;
display: flex;
flex-direction: column;
-webkit-box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
-moz-box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
background: #fff;
}
#media screen and (max-width: 1920px) {
.place
{
width: 30%;
}
}
#media screen and (min-width: 900px)
and (max-width: 1366px){
.place
{
width: 45%;
}
}
#media screen and (min-width: 768px)
and (max-width: 1366px){
.place
{
width: 44%;
}
}
#media screen and (min-width: 415px)
and (max-width: 760px){
.place
{
width: 90%;
}
}
#media screen and (max-width: 415px) {
.place
{
width: 90%;
}
}
.place_image
{
width: 100%;
height: 14.0625em;
background-size: cover !important;
background-clip: content-box !important;
}
.place_description
{
padding: 0.625em;
display: flex;
flex-direction: column;
flex: 1 1 0;
background: #fff;
}
.distance_container p.distance
{
font-weight:600;
}
.place_description p, .place_description a
{
color: #655e5e;
font-weight: 400;
margin: 0;
}
.place_description .place_open p
{
margin: 0;
color: #49b51c;
}
.place_description i.fa
{
width: 1.25em;
}
.place_title
{
flex: 1 1 0;
}
.place_title h3
{
color: #655e5e;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
margin: 0;
font-size: 1.4em;
line-height: 1.3;
}
#media screen and (max-width: 415px) {
.place_title h3
{
font-size: 1.2em;
}
}
.rating_container
{
width: 100%;
}
.rating_bar {
width: 6.875em;
height: 1.313em;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2605/star-rating-sprite.png);
background-repeat: repeat-x;
background-position: 0 0;
}
.rating {
height: 1.313em;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2605/star-rating-sprite.png);
background-position: 0 100%;
background-repeat: repeat-x;
}
.place_description .place_location
{
margin-bottom: 0.625em;
}
.place .distance_container, .place .vicinity_container, .place .place_phone_container
{
display: flex;
}
#load_container
{
padding: 1.25em;
text-align: center;
}
#load i.fa-spin
{
font-size: 4em;
color: #ec3b3b;
}
#jquery_placeholder
{
display:none;
width:100%;
}
footer
{
padding: 1.25em;
text-align: right;
background: #fff;
}
footer #google img
{
width: 10em;
}
#error
{
padding: 1.25em;
background: #ec3b3b;
}
#error p
{
font-size: 1.2em;
margin: 0;
color: #fff;
text-align: center;
}
#error i.fa-exclamation-circle
{
color: #fff;
}
Flexbox can do that providing you use flex-direction:column like so:
If you don't want sections to expand to take up spare space, just remove the flex:1.
html,
body {
height: 100%;
}
body {
min-height: 100%;
text-align: center;
/* for demo */
}
.page-wrap {
min-height: 100%;
display: flex;
flex-direction: column;
}
header {
background: pink;
}
footer {
background: rebeccapurple;
color: #fff;
}
aside {
flex: 1;
background: orange;
}
main {
flex: 1;
background: grey;
}
<div class="page-wrap">
<header>
<h1>Header</h1>
</header>
<aside>I'm a secondary header</aside>
<main>I'm main content</main>
<footer>
<h1>Footer</h1>
</footer>
</div>