padding beside image while using bootstrap/css - html

I am pretty new to web development. I have basic experience with html/css and am using bootstrap to create a website just to kind of teach myself. I want my image to cover the whole page which it does when i decrease the size of the browser but when using full screen it adds padding to the side.
full screen example
i have tried some things to fix it like changing padding to -20px or making overflow-x hidden but can't seem to fix it.
bootstrap code
<div id="banner" class="container-fluid">
<div class="col-lg-12 nopadding">
<img src="images/headercopy.jpeg">
</div>
</div>
css code
html, body {
line-height: 1.8;
background-color: rgb(0, 0, 0);
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
h3 {
text-align: center;
color: white;
}
.nav {
color: white;
}
.navbar-transparent .navbar-brand {
color: white; //nightalreadycolor
}
.navbar-collapse .page-scroll {
color: white; //nightalreadycolor
}
.navbar-transparent .navbar-brand:hover, .navbar-transparent .navbar-brand:focus {
background-color: transparent;
color: #c8e8f4; //light blue
}
.navbar .navbar-transparent .navbar-fixed-type {
background-color: red;
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.row {
margin-right: -15px;
margin-left: -15px;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
.aboutimage {
background-size: 100% 100%;
}
img {
display: block;
margin: 0 auto;
max-height: 100%;
max-width: 100%;
}
#about {
color: white;
height: 600px;
margin-right: 15px;
text-align: justify;
}
#about p {
display: block;
font-size: 20px;
margin-bottom: 1em;
margin-left: 0;
margin-right: 0;
color: white;
}
#about p img {
padding-top: 5px;
outline: solid #f00 1px !important;
}
.container {}
#fleet {
border-right: thin solid black;
color: white;
width: 50%;
height: 600px;
float: left;
background-color: grey;
}
#fleet h1 {
text-align: center;
}
#fleet h2 {
padding-right: 10%;
float: right;
}
#rates {
color: white;
width: 50%;
height: 600px;
float: right;
background-color: #574951;
}
#rates h1 {
text-align: center;
}
#contact {
text-align: center;
height: 600px;
color: white;
background-color: #574951;
}
#reservation {
display: inline-block;
height: 600px;
color: white;
text-align: center;
}
Sorry if some of my code seems to be redundant or inefficient like i said I'm still very new to all of this. If there's any other information you need let me know.

Use images as a background. So if it's the #banner div that you want to fill up, your css will be like this:
#banner {
background-image: url('images/headercopy.jpeg');
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
Then you just have to use this markup:
<div id="banner" class="container-fluid"></div>
Of course you can set to your css code for the #banner the height you want etc.

Related

My page seems to have right padding or margin when scaled further down?

My site is fine until I go lower than 723px wide then a white margin appears on the right side of all of my background colors. I have tried to go in and delete margins and padding to see where I have gone wrong. I also played with the width of the elements and it just stretches the image over the visible portion when I set the image to full. I've inspected the page and can not define the white space on the page and where it comes from.
I also tried adding display:inline-block; to my css background divs as well as setting the width: 100%.
CSS
body {
margin: 0;
font-family: 'Comic Neue', sans-serif;
}
main {
margin-top: none;
}
.hero_image {
background-image: url("C:/Users/Kascey.Malone/Documents/Websites/Midterm/images/669.png");
height: 100vh;
width: 100%;
position: relative;
background-size: 100% 100%;
display:inline-block;
}
/*NAVIGATION BAR*/
header {
height: fit-content;
}
header a {
font-weight: bold;
color: #FCD90A;
}
header a:link {
text-decoration: none;
}
header a:visited {
text-decoration: none;
}
header a:hover {
text-decoration: underline;
}
header a:active {
text-decoration: underline;
}
.topnav {
overflow: hidden;
text-decoration: none;
}
.left {
padding: 20px;
float: left;
width: 50%;
box-sizing: border-box;
text-decoration: none;
text-align: left;
}
.right {
padding: 20px;
float: right;
width: 50%;
box-sizing: border-box;
text-decoration: none;
text-align: right;
}
/*HERO BOX*/
.hero {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.hero h1 {
font-size: 15vw;
margin: 0;
text-align: center;
color: #9A1000;
font-style: italic;
}
.hero button {
padding: 1em;
margin-top: 10vh;
background-color: #FCD90A;
white-space: nowrap;
font-size: 1vw;
font-family: 'Comic Neue', sans-serif;
}
.hero button a{
text-decoration: none;
color: black;
}
.hero button a:link {
text-decoration: none;
}
.hero button a:visited {
text-decoration: none;
}
.hero button a:hover {
font-weight: bold;
}
.hero button a:active {
font-weight: bold;
}
.container {
position: relative;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/*MENU TABLE*/
.table {
background-color: white;
padding-top: 100px;
padding-bottom: 100px;
box-sizing:border-box;
}
table {
margin-left: auto;
margin-right: auto;
padding: 40px;
font-size: 1vw;
background-color: white;
border: solid 8px black;
box-sizing:border-box;
}/*Add border.*/
thead {
text-align: right;
}
td:nth-child(even) {
text-align: left;
padding-left: 100px;
}
td:nth-child(odd) {
text-align: right;
padding: 10px;
}
.row {
display: flex;
margin: 0 auto;
}
table a{
text-decoration: none;
color: black;
} /*Change color based off background*/
table a:link {
text-decoration: none;
}
table a:visited {
text-decoration: none;
}
table a:hover {
text-decoration: underline;
}
table a:active {
text-decoration: underline;
}
th {
padding: 10px;
}
/*ABOUT TEXT*/
.about {
height: auto;
padding-top: 5vh;
padding-bottom: 5vh;
background-color: #3823FC;
background-size: 100% 100%;
}
.column {
flex: 50%;
padding: 10px;
}
.column h2{
font-size: 2vw;
padding-left: 200px;
color: white;
}
.column p{
padding-right: 200px;
padding-top: 88px;
font-size: 1.5vw;
color: white;
}
.column img {
width: 30vw;
padding-left: 200px;
height: auto;
}
/*FOOTER*/
.footer {
background-color: #0C026C;
padding: 10px;
text-align: left;
color: white;
}
Try to use percentages for your padding/margins. Your size is scaling based on screen size with the percentages used.
Another option could be using display: flex; with flex containers.
Here is a helpful document to get you started.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
You could also use #Media tags in CSS for different screen sizes to fit things manually. Here is a reference to get you started: W3 Schools Reference

Why is gmail not responding to media-queries?

What's good StackOverflow? I've been trying to figure out for the longest while now why Gmail isn't picking up on my HTML Email's Media Query. It looks good with wide screen but Gmail isn't responding to my phone's screen width, so on phone looks weird and buggy.
I've already tried looking through similar questions, and even tried re-writing my CSS to the point to where I re-wrote my CSS several times to see if the media query would pick up even the smallest of change.
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width ,initial-scale=1" />
<style type="text/css">
#import url('https://fonts.googleapis.com/css?family=Libre+Baskerville');
body {
margin: 0;
padding: 15px;
}
.center {
text-align: center;
margin: 0 auto;
}
.wrapper {
width: 100%;
table-layout: fixed;
}
.inner-wrapper {
width: 100%;
max-width: 670px;
background: #554348;
margin: 0 auto;
}
table {
border-spacing: 0;
font-family: sans-serif;
color: #727f80;
}
.header-table {
text-align: center;
padding: 10px 0px 0 0;
}
.header-table .header {
width: 100%;
max-width: 610px;
display: inline-block;
background: #fff;
border-top: 2px solid #E5C2C0;
border-radius: 6px 6px 0 0;
padding-bottom: 24px;
}
.header-table img {
width: 75px;
float: left;
border: 2px solid #E5C2C0;
border-radius: 6px 0 0 0;
border-top: none;
}
.slogan {
color: #000;
font-size: 12px;
margin-top: 124px;
color: #7FC29B;
}
.slogan-hr {
width: 25vh;
}
.outer-table {
width: 100%;
max-width: 670px;
margin: 0 auto;
}
.outer-table img {
width: 100%;
max-width: 670px;
height: auto;
}
td {
padding: 0;
}
p {
margin: 0;
}
a {
color: #f1f1f1;
text-decoration: none;
}
.main-table {
width: 100%;
max-width: 610px;
margin: 0 auto;
border-radius: 6px;
margin-top: 25px;
margin-bottom: 25px;
background: #fff;
}
.three-column {
width: 100%;
}
.three-column img {
width: 120px;
}
.section {
/* Change display to inline-block on mobile */
width: 100%;
display: inline-flex;
margin-top: 15px;
margin-left: 30px;
}
.section .pic-container {
display: inline-block;
}
.section .desc-container {
margin: auto;
}
.desc-container td {
padding-bottom: 25px;
}
.desc-container .content {
margin-top: 32px;
}
.desc-table p {
margin-top: 5px;
margin-bottom: 10px;
}
.desc-table .h3 {
font-weight: bold;
text-transform: uppercase;
color: #424B54;
}
.desc-table .price {
font-size: 20px;
font-family: 'Libre Baskerville', serif;
color: #7FC29B;
}
.button-container {
margin-right: 90px;
margin-top: 65px;
height: 35px;
}
.btn-holder {
font-size: 25px;
padding: 9px;
border-radius: 25px;
color: #fff;
background: #4C4B63;
text-decoration: none;
}
.outer-table-2 {
width: 100%;
max-width: 670px !important;
background: #fff;
border-top: 3px solid #D4F5F5;
border-bottom: 3px solid #D4F5F5;
}
.call-to-action {
width: 100%;
max-width: 670px;
text-align: center;
}
.cta-text {
font-size: 24px;
margin-top: 30px;
margin-bottom: 30px;
color: #4C4B63;
}
.cta-button {
margin-top: 30px;
margin-bottom: 30px;
}
.outer-table-3 {
margin-top: 30px;
width: 100%;
max-width: 670px;
background: #4C4B63;
border-top: 2px solid #7FC29B;
border-radius: 6px 6px 0 0;
}
.footer-table {
width: 100%;
margin-top: 32px;
}
.footer-header-table {
width: 100%;
}
.footer-header {
color: #fff;
text-align: center;
}
.footer-header .heart {
color: red;
}
.footer-logo-table {
float: left;
}
.footer-logo {
width: 67px;
}
.footer-social-table {
width: 100%;
text-align: center;
}
.social-list {
display: inline-flex;
list-style: none;
}
.social-list li {
margin-left: 10px;
margin-right: 10px;
}
.social-list img {
width: 55px;
}
.footer-text-table {
float: right;
text-align: right;
margin-top: 25px;
}
.footer {
font-size: 12px;
color: #fff;
}
.footer a {
text-transform: uppercase;
color: red;
}
#media only screen and (max-width:360px) {
.cta-button .btn-holder {
font-size: 18px !important;
}
.footer-social-table {
width: 100%;
}
.social-list img {
width: 50px;
}
}
#media only screen and (max-width:768px) {
.wrapper {
overflow: hidden;
}
.section {
display: inline-block;
margin: 0;
margin-top: 15px;
text-align: center;
}
.pic .content {
width: 100%;
}
.section .home {
width: 65%;
}
.desc-container {
width: 100%;
}
.desc-table {
margin: 0 auto;
}
.desc-table .h3 {
font-size: 20px;
}
.desc-table .price {
font-size: 24px;
}
.size {
font-size: 20px;
}
.section .button-container {
margin-top: 25px;
margin-bottom: 25px;
width: 100%;
}
.button-container .button-table {
margin: 0 auto;
padding-bottom: 25px;
}
.outer-table-2 {
width: 100%;
}
.cta-button .btn-holder {
font-size: 23px;
}
.outer-table-3 {
width: 100%;
}
.footer-social-table {
width: 100%;
}
.social-list {
padding: 0;
}
}
</style>
</head>
I figured it was because it was because the #media screen and it had to be either "#media only screen" or "#media (){..." but none of those did anything.
What I expected (running on web browser) vs what actually happens (gmail app)
Here's a link to the whole code:
JSFiddle
Even if you can't help, thank you for reading.
UPDATE!!!
Thanks to Digital_Frankenstein, I was able to fix the problem. What I should've done was add some !important tags on my CSS, and specifically on the media queries. For future HTML Email Devs, don't forget this. Because this is really important.
took me a while to debug this, taking section by section out.
I hate default styles in the head. Makes it so much harder to debug, but each to their own and I know a lot of people are shifting to that method because of the Gmail update.
To resolve your issues in Gmail:
You need to add !important to all media query CSS, to override default styling.
Your slogan-hr was pushing everything out because of it's vh base width. In your media query I added an override of width:90%!important;.
You need to reduce the font size of your last button. It's blowing out at 23px in Gmail. I would suggest 20px maybe?
Your footer doesn't look too great. Best if you fiddle with that further, as both items sitting right up against the edges doesn't look great.
Finally, I would suggest avoiding this technique if you aren't completely confident with it.
I personally don't see the worth in it, since Gmail started rendering responsive code, but I know some devs use it for the outlier mobile email clients and that makes sense.
But I stick with old school tables since it just works and my clients will be managing the templates.
If I were always available to update and manage the templates I build, then it makes sense.
Just some food for thought. Hope this resolves your issues :)
In My case, actually I was using the other syntax which was working fine in other place but not in gmail so if you are using this syntax
#media only screen and (max-width: 480px) {
table[class="w320"] {
width: 320px !important;
}
This works fine in all other places but not in gmail app, so for that use the better syntax:
#media only screen and (max-width: 480px) {
table.w320{
width: 320px !important;
}
}

CSS flex: Third "card" showing beside the first two, I would like it below

I have a pestering question I'd like an opinion on. I apologize if this has been answered. I have looked at similar questions, and tried the solutions, but I can't find the one that works for me.
I am working on a personal website right now and I have the home page how I like it, but I am trying to get the experience page to display correctly. Right now, I am trying to have 3-4 "cards" of content. The first two should show up in the main section side by side, and the third (and fourth if necessary) should show up below them as follows"
1 2
3 (centered, ideally the width of the first two items)
OR
1 2
3 4
Currently no matter what I try (clearing, changing the flex direction, etc) I am getting the following with the items squished together.
1 2 3...
I have attached my full styles.css (I apologize for the mess) so someone brighter than me can hopefully help me resolve the problem, and a snippet of my HTML so you can get an idea of how I am using this.
Thank you so much in advance!!!
Styles.css
/* Global Layout Set-up */
{
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
text-align: center;
font-family: 'Roboto', sans-serif;
color: #222;
background: #f7f5f0;
}
/* Link Styles */
a {
text-decoration: none;
color: #0499ff;
}
a:hover {
color: #6633ff;
}
/* Section Styles */
.main-nav {
width: 100%;
background: black;
min-height: 30px;
padding: 10px;
position: fixed;
text-align: center;
margin: auto;
}
.nav {
display: flex;
justify-content: space-around;
font-weight: 700;
list-style-type: none;
margin: 0 auto;
padding: 0;
}
.nav .name {
display: none;
}
.nav li {
padding: 5px 10px 5px 10px;
}
.nav a {
transition: all .5s;
}
.nav a:hover {
color: white
}
header {
text-align: center;
background: url('images/realrocket5.jpg') no-repeat top center ;
background-size: cover;
overflow: hidden;
padding-top: 60px;
}
header {
line-height: 1.5;
}
header .profile-image {
margin-top: 50px;
width: 150px;
height: 150px;
border-radius: 50%;
border: 3px solid black;
transition: all .5s;
}
header .profile-image:hover {
transform: scale(1.2) rotate(360deg);
}
.tag {
background-color: #efefef;
color: black;
padding: 10px;
border-radius: 5px;
display: table;
margin: 10px auto;
}
.location {
background-color: #222;
color: white;
}
.card {
float: left;
max-width: 40%;
margin: 30px;
padding: 20px 40px 20px;
text-align: left;
background: #fff;
border-bottom: 4px solid #ccc;
border-radius: 6px;
}
.card-below{
float: left;
margin: 30px;
padding: 20px 40px 40px;
text-align: left;
}
.card:hover {
border-color: #0399ff;
}
ul.skills {
padding: 0;
text-align: center;
}
.skills li {
border-radius: 6px;
display: inline-block;
background: #ff9904;
color: white;
padding: 5px 10px;
margin: 2px;
}
.skills li:nth-child(odd) {
background: #0399ff;
}
footer {
width: 100%;
min-height: 30px;
padding: 20px 0 40px 20px;
}
footer .copyright {
top: -8px;
margin-right: 20px;
font-size: .75em;
}
footer ul {
list-style-type: none;
margin: 0;
padding: 0;
}
footer ul li {
display: inline-block;
}
a.social {
display: inline-block;
text-indent: -9999px;
margin-left: 5px;
width: 30px;
height: 30px;
background-size: 30px 30px;
opacity: .5;
transition: all .25s;
}
a.twitter {
background-image: url(images/twitter.svg);
}
a.linkedin {
background-image: url(images/linkedin.svg);
}
a.github {
background-image: url(images/github.svg);
}
a.social:hover {
opacity: 1;
}
.clearfix {
clear: both;
}
/* Styles for larger screens */
#media screen and (min-width: 720px) {
.flex {
display: flex;
max-width: 1200px;
justify-content: space-around;
margin: 0 auto;
}
.flex-column {
flex-direction: column;
}
header {
min-height: 450px;
}
.nav {
max-width: 1200px;
}
.nav .name {
display: inline-block;
border: solid #2204ba 3px;
border-radius: 15px;
background-color: #222;
margin-right: auto;
margit-left: left;
text-align: center;
color: #0399ff;
}
.nav .navbar {
display: inline-block;
border: solid #2204ba 3px;
border-radius: 15px;
background-color: #222;
margin-right: 5px;
text-align: center;
color: #0399ff;
}
main {
padding-top: 50px;
}
main p {
line-height: 1.6em;
}
footer {
font-size: 1.3em;
max-width: 1200px;
margin: 40px auto;
}
}
h3 {
color: black;
letter-spacing: 0.5px;
}
.card-title {
text-align: center;
border: solid black 3px;
border-radius: 10px;
background-color: #222;
color: white;
}
HTML
<main class="flex">
<div class="card">
<h2 class="card-title">Card1</h2>
<p>Stuff goes here, up to 500px wide</p>
</div>
<div class="card">
<h2 class="card-title">Card2</h2>
<p>More stuff goes here up to 500px wide</p>
</div>
<div class="card">
<div class="flex-column">
<h2 class="card-title">Card3</h2>
<p>The problem card. This stuff needs to go below card one in its own card.</p>
</div>
</div>
</main>
If I only use two cards per page they appear side by side correctly. When trying to add a third, it just goes beside the last card and I can't for the life of me figure out how to make it go below. Ideally, if using 3 cards the first two would be centered side by side, then the third would be centered below the same width as the first two cards combined. If a 4th card is used, I'd like it to basically be a square. Thank you so much for any input!!!!
.wrap {
width: 500px;
background: gray;
margin: auto;
padding: 10px;
margin-bottom: 20px;
}
.row {
display: flex;
justify-content: center;
}
.box {
padding: 20px;
background: yellow;
min-width: 75px;
flex-grow: 1;
margin: 2px;
text-align: center;
}
<div class="wrap">
<div class="row">
<div class="box">
Box One
</div>
<div class="box">
Box Two
</div>
</div>
<div class="row">
<div class="box">
Box Three
</div>
</div>
</div>
<div class="wrap">
<div class="row">
<div class="box">
Box One
</div>
<div class="box">
Box Two
</div>
</div>
<div class="row">
<div class="box">
Box Three
</div>
<div class="box">
Box Four
</div>
</div>
</div>

set div at bottom of page without overlapping another div at smaller screen sizes

I would like to vertically align 2 divs - a footer div at the bottom of my page (about 15px margin from the bottom), and a content div in the center of the page). The webpage will be responsive. Her is the jsfiddle of the page:
https://jsfiddle.net/tyvodoh0/1/
<div class="wrapper">
<div class='center'>
<div id='content'>
<div id='profile_pic'>
<img src='http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg'/>
</div>
<div id='information'>
<h1>Title</h1>
<h2>Subtitle</h2>
<p> 4
down vote
favorite
Does the position of the sun in a hollow earth scenario affect the way light scattering would "color" the sky?
My understanding is the reddish-orange color during sunrise/sunset is caused by the sun being at a more oblique angle in contrast to the standard blue when the sun is fully up.
My intuition states that the sky's color wouldn't change much, or if it did would become a washed out version of whatever it normally would be, ie blue on Earth. The most dramatic coloring that I could imagine would be a gradient from say blue to red as you look from the center of the sky to the horizon, given an Earth colored sun and atmosphere. I doubt the gradient scenario is possible, but it would be neat if it was.
</p>
</div>
</div>
<div class='footer'>
<p>
Div to be set at bottom
</p>
</div>
</div>
</div>
/* css */
h1 {
color: #3a2a0c;
font-size: 47px;
text-transform: uppercase;
margin-bottom: 14px;
}
h2 {
color: #3a2a0c;
font-size: 28px;
text-transform: capitalize;
margin-bottom: 14px;
}
h3 {
color: #926d55;
font-size: 15px;
margin-bottom: 40px;
}
p {
color: #3a2a0c;
font-size: 15px;
text-align: justify;
line-height: 110%;
border-bottom: 1px solid #caccc6;
}
hr {
border-color: #3edf4f6;
margin-top: 50px;
}
.wrapper {
background-color: rgba(255,255,255,0.9);
padding: 0;
margin: 0;
top: 0;
left: 0;
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.center {
display: table-cell;
vertical-align: middle;
background: pink;
float: none;
}
#content {
margin-left: auto;
margin-right: auto;
width: 1235px;
background: red;
}
#profile_pic {
width: 396px;
padding-right: 33px;
float: left;
background: blue;
}
#profile_pic img {
width: 396px;
height: auto;
}
}
#information {
width: 806px;
background: yellow;
float: left;
}
#contact {
font-size: 15px;
color: #926d55;
}
.hide {
display: none;
}
#contact span {
margin-right:22px;
}
#information p {
padding: 40px 0;
}
#left {
float: left;
}
#right {
float: right;
}
.links {
padding-top: 15px;
font-size: 15px;
}
.links img {
margin-right: 6px;
}
.links a {
margin-left: 6px;
margin-right: 6px;
color: #3a2a0c;
}
.links a:last-child {
margin-right: 0px;
}
.links a:hover {
color: #926d55;
}
.footer {
float: none;
position: absolute;
top: 90%;
}
I edited your code to make it responsive. You can work further to fix the position of the image when the window is resize.
h1 {
color: #3a2a0c;
font-size: 47px;
text-transform: uppercase;
margin-bottom: 14px;
}
h2 {
color: #3a2a0c;
font-size: 28px;
text-transform: capitalize;
margin-bottom: 14px;
}
h3 {
color: #926d55;
font-size: 15px;
margin-bottom: 40px;
}
p {
color: #3a2a0c;
font-size: 15px;
text-align: justify;
line-height: 110%;
border-bottom: 1px solid #caccc6;
}
hr {
border-color: #3edf4f6;
margin-top: 50px;
}
.wrapper {
background-color: rgba(255,255,255,0.9);
padding: 0;
margin: 0;
top: 0;
left: 0;
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.center {
display: table-cell;
vertical-align: middle;
background: pink;
float: none;
}
#content {
margin: auto;
width: 100%;
background: red;
padding: 10px;
}
#profile_pic {
width: 396px;
padding-right: 33px;
float: left;
background: blue;
}
#profile_pic img {
width: 396px;
height: auto;
}
/*
#information {
width: 806px;
background: yellow;
float: left;
}
*/
#contact {
font-size: 15px;
color: #926d55;
}
.hide {
display: none;
}
#contact span {
margin-right:22px;
}
#information p {
padding: 40px 0;
}
#left {
float: left;
}
#right {
float: right;
}
.links {
padding-top: 15px;
font-size: 15px;
}
.links img {
margin-right: 6px;
}
.links a {
margin-left: 6px;
margin-right: 6px;
color: #3a2a0c;
}
.links a:last-child {
margin-right: 0px;
}
.links a:hover {
color: #926d55;
}
.footer {
float: none;
top: 90%;
width: 100%;
padding: 10px;
}
<div class="wrapper">
<div class='center'>
<div id='content'>
<div id='profile_pic'>
<img src='http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg'/>
</div>
<div id='information'>
<h1>Title</h1>
<h2>Subtitle</h2>
<p> 4
down vote
favorite
Does the position of the sun in a hollow earth scenario affect the way light scattering would "color" the sky?
My understanding is the reddish-orange color during sunrise/sunset is caused by the sun being at a more oblique angle in contrast to the standard blue when the sun is fully up.
My intuition states that the sky's color wouldn't change much, or if it did would become a washed out version of whatever it normally would be, ie blue on Earth. The most dramatic coloring that I could imagine would be a gradient from say blue to red as you look from the center of the sky to the horizon, given an Earth colored sun and atmosphere. I doubt the gradient scenario is possible, but it would be neat if it was.
</p>
</div>
</div>
<div class='footer'>
<p>Div to be set at bottom</p>
</div>
</div>
</div>
The height of the .wrapper is set to: height:100%, you can remove it if you do not need it.
From what I can see you want the wrapper div to cover the 100% of the height and the width of the page, and in order to set the footer at the bottom of the page you need to change the footer class to
.footer {
margin-bottom: 15px;
position: absolute;
bottom: 0;
}
This will allow the div to stay at the bottom with a margin of 15 px.

Same div heights for sidebar and content

Assume following html page:
<html>
<head></head>
<body>
<div id="wrapper">
<div id="header"/>
<div id="navigation"/>
<div id="leftcolumn"/>
<div id="content/>
<div id="footer"/>
</div>
</body>
</html>
What I'm trying to achieve is that the leftcolumn div and the content div always have the same height. Sometimes the leftcolumn div is higher than the content div because there is little content and vice versa: when there is a lot of content, the content div is higher than the leftcolumn div.
The situation as it is now produces some lay-out shenanigans because the body background, leftcolumn background and content background are all in a different colour.
This is my CSS as-is:
* {
padding: 0;
margin: 0;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #FFFEE9;
}
#wrapper {
margin: 0 auto;
width: 900px;
height: auto;
}
#content {
float: left;
color: #006350;
background: #DEE3DC;
height: 100%;
display: inline;
width: 730px;
}
#contents {
margin: 35px;
}
#contents h1, h2 {
padding-bottom: 15px;
}
#contents p {
padding-top: 5px;
padding-bottom: 5px;
}
#header {
color: black;
width: 900px;
float: left;
height: 160px;
background: #FFFEE9;
margin-top: 10px;
}
#navigation p {
padding: 3px;
}
#footer {
width: 900px;
height: 40px;
clear: both;
color: white;
background: #83422D;
font-size: 80%;
}
#footer a {
color: white;
text-decoration: none;
}
#footer p {
padding: 4px;
}
#navigation {
float: left;
width: 900px;
height: 25px;
color: white;
background: #83422D;
}
#navigation a {
text-decoration: none;
color: white;
}
#navigation a:hover {
text-decoration: underline;
}
#leftcolumn {
color: white;
background: #006350;
height: 100%;
width: 170px;
float: left;
}
#leftcolumn a {
text-decoration: none;
color: white;
}
#leftcolumn a:hover {
text-decoration: underline;
}
#leftcolumn li {
padding-bottom: 10px;
}
#leftcolumn ul {
margin-left: 20px;
margin-top: 20px;
list-style: none;
}
.centered {
text-align: center;
margin: auto;
display: block;
}
#gallery {
height: 300px;
width: 650px;
}
#gallery img {
margin-right: 50px;
margin-top: 50px;
}
#gallerytext {
width: 400px;
font-size: 75%;
color: black;
position: relative;
margin-left: 155px;
margin-top: -100px;
text-align: justify;
}
I've tried using a combination of CSS styles like height: 100%, height:inherit, height:auto,... on the different divs (wrapper, leftcolumn and content) but I can't seem to get the result I want. Bottom line: what CSS styles should I use if I want the leftcolumn and content div have the same height, regardless of which one is higher at that time. (And without using javascript please).
JsFiddle example where the leftcolumn is larger: http://jsfiddle.net/CQPnF/4/
Example where the content is larger: http://jsfiddle.net/BQkme/
You can get your desired results with the use of display:table-cell rather float in your left and right panels :-
I have removed float from your #content & #leftcolummn and gave them display:table-cell; and its working fine as per your requirement.
UPDATED CSS
* {
padding: 0;
margin: 0;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #FFFEE9;
}
#wrapper {
margin: 0 auto;
width: 900px;
overflow:hidden;
}
#content {
color: #006350;
background: #DEE3DC;
display:table-cell;
width: 730px;
}
#contents {
margin: 35px;
}
#contents h1, h2 {
padding-bottom: 15px;
}
#contents p {
padding-top: 5px;
padding-bottom: 5px;
}
#header {
color: black;
width: 900px;
float: left;
height: 160px;
background: #FFFEE9;
margin-top: 10px;
}
#navigation p {
padding: 3px;
}
#footer {
width: 900px;
height: 40px;
clear: both;
color: white;
background: #83422D;
font-size: 80%;
}
#footer a {
color: white;
text-decoration: none;
}
#footer p {
padding: 4px;
}
#navigation {
float: left;
width: 900px;
height: 25px;
color: white;
background: #83422D;
}
#navigation a {
text-decoration: none;
color: white;
}
#navigation a:hover {
text-decoration: underline;
}
#container {
border:1px solid red;
overflow:hidden;
}
#leftcolumn {
color: white;
background: #006350;
width: 170px;
display:table-cell;
}
#leftcolumn a {
text-decoration: none;
color: white;
}
#leftcolumn a:hover {
text-decoration: underline;
}
#leftcolumn li {
padding-bottom: 10px;
}
#leftcolumn ul {
margin-left: 20px;
margin-top: 20px;
list-style: none;
}
.centered {
text-align: center;
margin: auto;
display: block;
}
#gallery {
height: 300px;
width: 650px;
}
#gallery img {
margin-right: 50px;
margin-top: 50px;
}
#gallerytext {
width: 400px;
font-size: 75%;
color: black;
position: relative;
margin-left: 155px;
margin-top: -100px;
text-align: justify;
}
see the demo :- http://jsfiddle.net/BQkme/10/
This solution is a teensy bit hacky because you need some supporting markup, but it does work and I have used it before.
http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks
The main issue I have with it is that you have to nest your content divs to a depth equaling the number of columns. In your case, it's not a huge problem because you'd only be nesting your content inside 2 container divs.
Your markup might end up looking something like the following:
<html>
<head></head>
<body>
<div id="wrapper">
<div id="header"/>
<div id="navigation"/>
<div id="container_content">
<div id="container_leftcolumn">
<div id="leftcolumn"/>
<div id="content/>
</div>
</div>
<div id="footer"/>
</div>
</body>
</html>
You need to use absolute positioning.
Here is a working Live Demo.
Hope this helps.