Related
Div should not be over Div with background image with divs inside, but for some reason the about div is displayed over the nav:
body {
margin: 0;
padding: 0;
/*background-color: blue;*/
}
.divider {
background-color: #be2b27;
width: 100%;
height: 100px;
position: absolute;
display: block;
padding: 0;
}
.divider h1 {
font-family: "Nexa Light";
font-size: 2em;
color: white;
text-align:left;
padding-left: 10px;
}
.lorem-text {
font-family: "Menlo";
font-size: 1.2em;
color: white;
}
.start-section {
margin-top: 30px;
/* position: absolute; */
padding-left: 20px;
padding-top: 20px;
}
#start-bg {
background-image: url(water.jpg);
background-color:#9abee1;
background-repeat: round;
height:100%;
position: absolute;
}
#home-head {
font-family: 'Nexa Light';
/* font-size: ; */
padding-top: 30px;
color: white;
}
.nav { }
<div id="start-bg">
<!--<div class="nav"...>...</div>-->
<div class="start-section">
<h1 id="home-head">Landing Page</h1>
<p class="lorem-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ornare est in maximus vestibulum.
Mauris eu tincidunt quam.<br> In commodo neque id tortor mattis, non consectetur ante tincidunt.
Nunc ultrices ultricies purus, id finibus justo eleifend sit amet.<br>
Sed in iaculis libero, et gravida nibh.
Proin mollis, nibh eu rhoncus scelerisque, orci ex posuere mi, id pharetra purus est suscipit sapien.
Aliquam fermentum dignissim ultricies. Cras vitae neque tincidunt, tristique neque at, ornare leo.<br>
Integer gravida lectus sed venenatis auctor. Vestibulum sed ligula eget dui ultrices luctus.<br>
Etiam dapibus auctor sollicitudin. Nam vel dui non lorem semper scelerisque. Donec sed condimentum mauris.
Maecenas ac enim sit amet orci sodales porta.
</p>
<img src="http://via.placeholder.com/350x150">
<img src="http://via.placeholder.com/350x150">
<img src="http://via.placeholder.com/350x150"><br>
<img src="http://via.placeholder.com/350x150">
<img src="http://via.placeholder.com/350x150">
<img src="http://via.placeholder.com/350x150"><br>
</div>
</div>
<div class="divider">
<h1>About</h1>
</div>
There must be something wrong with the positions or something or the fact that when the div has a background image it is not registered as holding any content so the about div is displayed above it.
What do I need to do?
I want the div to be displayed after the background image ends and stays there when I remove the images. If you need the nav html and css code i will give it to you.
#start-bg {
background-image: url(water.jpg);
background-color:#9abee1;
background-repeat: round;
height:100%;
position: absolute;
}
If you remove:
position: absolute;
Red bar go to bottom bottom of the page.
I'm back, and doing yet another school project. I'm trying to get my site to use some custom font that I found online. This is my JSFiddle link to my code, and my HTML code is as follows:
<!doctype html>
<html>
<head>
<title>
| Bat-tection |
</title>
<meta charset="utf-8">
<link href="Styles/index.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<header>
<h1 id="title">
Bat-Tection
</h1>
<h6 id="ctrtitle">
The only home protection service you will ever need!
</h6>
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Products</li>
<li>Services</li>
<li>Contact</li>
</ul>
</nav>
</header>
<aside>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
<p>The Sidebar Content</p>
</aside>
<section class="text">
<article>
<h2>Article One Heading</h2>
<p>
Article One Content<img src="../Tuts/Images/pic07.jpg" alt="A Generic Image Caption Here" class="rgt">
</p>
<p>
Vestibulum mi felis, sollicitudin nec iaculis at, facilisis a dolor. Curabitur posuere vulputate egestas. Vestibulum a leo id sapien commodo aliquam commodo quis dui. Phasellus at leo id elit dignissim egestas a eu elit. Quisque bibendum tellus at placerat luctus. Nulla blandit erat ipsum, eu molestie purus sollicitudin sit amet. Sed vehicula tortor quis libero finibus fringilla. Nam nibh mauris, lacinia a suscipit et, fringilla non lorem. Vestibulum tempor vel ligula ut interdum. Donec convallis porttitor est sit amet porttitor. Sed ullamcorper mauris nibh, id fermentum velit iaculis quis. Etiam rutrum blandit hendrerit. Proin a laoreet purus.
</p>
<p>
Curabitur sed leo ligula. Duis sed bibendum mi. Quisque fermentum, lacus in suscipit vulputate, tellus eros tempus metus, non convallis justo augue et turpis. Sed ut tempor elit. Pellentesque congue turpis turpis, nec lobortis arcu sollicitudin non. Nunc pellentesque luctus massa ac faucibus. Nulla ac libero ut diam consectetur euismod sed eget odio. Phasellus maximus justo eget ultricies consectetur. Curabitur nec mi lectus. Nunc vel varius enim. Praesent pulvinar nisi volutpat, facilisis ligula at, volutpat lorem. Mauris nec cursus libero, eget dictum arcu. Praesent tristique lacinia erat sed vestibulum. Cras vestibulum tellus vel urna bibendum eleifend. Proin non nisi ut sapien mattis blandit ut in tellus. Maecenas congue magna nec purus suscipit, in pellentesque quam blandit.
</p>
</article>
<p class="spec"></p>
<article class="cols">
<h2 class="cols-span">Lorem ipsum dolor sit</h2>
<p class="lead cols-span">
Vestibulum mi felis, sollicitudin nec iaculis at, facilisis a dolor.
</p>
<p>
Curabitur sed leo ligula. Duis sed bibendum mi. Quisque fermentum, lacus in suscipit vulputate, tellus eros tempus metus, non convallis justo augue et turpis. Sed ut tempor elit. Pellentesque congue turpis turpis, nec lobortis arcu sollicitudin non. Nunc pellentesque luctus massa ac faucibus. Nulla ac libero ut diam consectetur euismod sed eget odio. Phasellus maximus justo eget ultricies consectetur. Curabitur nec mi lectus. Nunc vel varius enim. Praesent pulvinar nisi volutpat, facilisis ligula at, volutpat lorem. Mauris nec cursus libero, eget dictum arcu. Praesent tristique lacinia erat sed vestibulum. Cras vestibulum tellus vel urna bibendum eleifend. Proin non nisi ut sapien mattis blandit ut in tellus. Maecenas congue magna nec purus suscipit, in pellentesque quam blandit.
</p>
</article>
</section>
<aside class="ads">
<p>
Advertisment can run the size out to the margin of the previous container element, no more!
</p>
<p>
Advertisment
</p>
<p>
Advertisment
</p>
<p>
Advertisment
</p>
<p>
Advertisment
</p>
<p>
Advertisment
</p>
</aside>
<footer>
<p>
Copyright © 2016 All Right Reserved
</p>
</footer>
</div>
</body>
</html>
My CSS code is as follows:
#charset "utf-8";
/*Browser Reset*/
body, p, header, aside, section, article, h1, h2, h3, nav, div, footer{
padding: 0;
margin: 0;
}
/*Style Start*/
#font-face {
font-family: battext;
src: url(../Fonts/batmfa.eot), /* IE9 Compat Modes */
src: url(../Fonts/batmfa.eot?#iefix) format(embedded-opentype), /* IE6-IE8 */
url(../Fonts/batmfa.woff2) format(woff2), /* Super Modern Browsers */
url(../Fonts/batmfa.woff) format(woff), /* Pretty Modern Browsers */
url(../Fonts/batmfa.ttf) format(truetype), /* Safari, Android, iOS */
url(../Fonts/batmfa.svg#svgFontName) format(svg); /* Legacy iOS */
}
.ads{
float: right;
text-align: center;
font-size: 90%;
color: #b498989;
}
.ads p{
background-color: #29292C;
padding-top: 0.3em;
}
aside{
overflow: hidden;
max-width: 200px;
float: left;
min-height: 900px;
background-color: #29292C;
}
aside p{
padding: 0px 20px;
}
article p{
text-indent: 2em;
padding-left: 1.5em;
}
body{
font-family: "battext";
color: #FFFD5D;
background-color: #252122;
font: 100% Verdana;
}
#ctrtitle{
text-align: center;
}
.cols{
/*-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
-webkit-column-gap: 10px;
-moz-colum-gap: 10px;
column-gap: 10px;*/
-webkit-column-width: 200px;
-moz-column-width: 200px;
column-width: 200px;
}
.cols-span{
-webkit-coloumn-span: all;
-moz-column-span: all;
column-span: all;
font-size: 1.2em;
margin-bottom: 0.2em;
line-height: 1.2em;
}
.cols p{
margin-bottom:1.1em;
text-align: justify;
}
footer{
clear: both;
background-color: #29292C;
text-align: center;
font-size: 85%;
min-height: 100px;
}
footer p{
padding-top: 3%;
}
header{
background-color: #29292C;
padding-bottom: 1em;
}
header h1{
text-align: center;
color: #252122;
font-weight: 900;
font-size: 2.5em;
margin: 0 0 1em 0;
}
.lead{
font-family: Georgia;
font-size: 1.3em;
text-align: left;
font-style: italic;
}
nav ul{
text-align: center;
margin: 1em;
list-style: none;
}
nav ul li{
display: inline-block;
margin: 0 0.35em;
nav ul li a{
background-image: url(../Images/bat-button1.jpg);
background-size:contain;
background-position: center;
background-repeat: no-repeat;
border-radius: 5px;
color: #e1e2dd;
text-decoration: none;
padding: 0.6em 1.2em 0.6em 1.2em;
outline: 0;
}
nav ul li a:hover{
background-image: url(../Images/bat-button2.jpg);
background-size:contain;
background-position: center;
background-repeat: no-repeat;
}
nav ul li ul{
display: none;
}
p{
margin-bottom: 1.2em;
}
.rgt{
float: right;
max-width: 30%;
padding: 0.3em;
}
section{
padding: 10px;
float: left;
max-width: 65%;
}
.spec{
margin: -5px 0 10px 0;
border-bottom: 1px dashed #000000;
line-height: 0;
}
.text{
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
}
#title{
color: #FFFD5D;
}
#wrapper{
max-width: 1200px;
margin: 0 auto;
background-color: #403E3A;
}
Can you guys off me any help?
Thanks,
-dark_nemesis
what i understand from your question is that you want to know how to use fonts, isn't it?
you can always visit https://www.google.com/fonts and under every font there is a button about how to use this font.
You're just missing a line of code (I think) it is
font-family: battext, sans-serif;
If you insert that under the body element as well as the font-face. Then I think it will work. Hope this helps...
take the quotations off the css
font-family: "battext"
side note, check to make sure you have right to use it in whatever you're doing
also check to make sure the file path is correct.
If your structure is like this: (upper case = folders)
HTML
index.html
CSS
styles.css
FONT
myfont.ttf
then.. these should be your code
html: <link type="text/css" rel="stylesheet" href="../css/styles.css" />
take off "../" if index.html is same level as CSS/FONT folder
css: #font-face { font-family: myfont; src: url(../font/myfont.ttf); }
the src for css will start where in the folder it's in, so styles.css has to go back a directory, then go to font and your file
I am creating an responsive web page. I have two articles floated left and two asides floated right. I would like the two asides to align vertically at the top with the first article. Originally the asides aligned perfectly with the articles as in the HTML I put the asides in between the two articles.
But when making the page responsive, I found that when I tried to collapse the asides to the bottom of the page, beneath the articles, they showed up in the middle of the two articles when I wanted the asides to show up underneath the two articles. So I moved the asides to the bottom of the page in my HTML, and thus my problem was created.
I have tried to clear the floats and to display both the articles and asides with inline-block but I wasn't able to make it work.
EDIT: A person suggested (and then deleted their response?) absolute positioning the asides. I have tried to do this, but I feel like it messes up the responsive design so I would like to avoid it if possible.
Here is the JSfiddle.
#charset"utf-8";
/* CSS Document */
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content:'';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* End of CSS reset */
/* apply a natural box layout model to all elements, but allowing components to change */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
/* General styles */
/* Background pattern from Subtle Patterns, by Atle Mo: http://subtlepatterns.com/green-cup/ */
body {
line-height: 1.4;
background-image: url(../images/green_cup.png);
}
.wrapper {
width: 960px;
/* 960px; */
margin: 0 auto;
}
/* Header styles */
header {
font-family:'Playfair Display', serif;
font-size: 23px;
}
.header-text {
margin: 0 auto;
width: 800px;
font-family:'Playfair Display', serif;
text-align: center;
color: #1d464f;
font-size: 2.1em;
/* 50px; */
}
.header-text-below {
margin: 0 auto;
width: 800px;
text-align: center;
font-family:'Merriweather', serif;
font-size: 1.1em;
/* 25px; */
color: #256139;
padding-bottom: 10px;
}
/* End Header styles */
/* Nav */
nav {
width: 100%;
background-color: white;
border-bottom: 4px solid #78605C;
height: 60px;
}
nav ul {
padding-top: 7px;
margin-left: 19%;
}
nav li {
float: left;
display: block;
text-align: center;
list-style-type: none;
width: 19%;
}
nav a {
display: block;
font-family:'Playfair Display', serif;
color: #2A879C;
text-decoration: none;
font-size: 30px;
}
nav a:hover, nav a:focus, nav a:active {
color: #78605C;
}
/* Typography */
h1 {
color: #1d464f;
}
.article-header {
color: #1d464f;
padding-top: 4px;
font-size: 35px;
}
p {
font-family:'Merriweather', serif;
line-height: 1.4em;
font-size: 1em;
}
.date-circle {
font-family:'Merriweather', serif;
border-radius: 50%;
background-color: #78605C;
color: white;
height: 60px;
width: 60px;
float: left;
font-size: 14px;
text-align: center;
padding-top: 20px;
margin-right: 10px;
margin-bottom: 5px;
clear: both;
}
.read-more a {
color: #78605C;
font-family:'Merriweather', serif;
text-decoration: none;
font-weight: bold;
}
.featured {
color: #256139;
font-family:'Merriweather', serif;
font-weight: bold;
font-size: 20px;
}
/* End Typography */
img {
max-width: 100%;
height: auto;
}
/* Articles */
article {
float: left;
display: inline-block;
width: 67.39%;
/* 620px / 960px = 67.39%, target / context = result */
padding: 10px;
padding-top: 10px;
background-color: white;
}
article:nth-of-type(2) {
margin-bottom: 20px;
}
.clear {
clear: left;
}
/* Borders of articles and asides */
article:nth-of-type(1) {
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-color: #DED8AA;
border-width: 4px;
}
article:nth-of-type(2) {
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-color: #DED8AA;
border-width: 4px;
}
aside:nth-of-type(1) {
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-color: #DED8AA;
border-width: 4px;
}
aside:nth-of-type(2) {
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-color: #DED8AA;
border-width: 4px;
}
/* End borders */
/* Aside, right side div */
aside {
float: right;
width: 31.25%;
/* 300px / 960px = 31.25%, target / context = result */
padding: 10px;
padding-top: 10px;
background-color: white;
}
/* Font awesome styling, social media icons from: http://fortawesome.github.io/Font-Awesome/ */
.iconContact {
width: 235px;
margin: 0 auto;
}
.iconContact a {
color: #2A879C;
transition: color 0.3s ease;
text-align: center;
float: left;
display: inline-block;
padding: 10px;
}
.iconContact a:hover {
color: #78605C;
}
/* Media queries
Your blog web page should be usable at the following sizes at a minimum:
i. Smartphone – portrait (320px wide)
ii. Smartphone – landscape (480px wide)
iii. Tablet – portrait (768px wide)
iv. Tablet – landscape(1024px wide)
v. Desktop – widths wider than 1024px
*/
#media only screen and (max-width: 1080px) {
main {
width: 90%;
margin: 0 auto;
}
.article-header {
padding-top: 8px;
font-size: 1.2em;
/* 35px; */
}
#media only screen and (max-width: 980px) {
.wrapper {
width: 80%;
/* 960px; */
margin: 0 auto;
}
nav ul {
padding-top: 7px;
margin-left: 0;
}
nav li {
float: left;
display: block;
text-align: center;
list-style-type: none;
width: 25%;
}
.header-text {
margin: 0 auto;
width: 80%;
/* 800px; */
font-family:'Playfair Display', serif;
text-align: center;
color: #1d464f;
font-size: 2.1em;
/* 50px; */
}
.header-text-below {
margin: 0 auto;
width: 80%;
/* 800px; */
text-align: center;
font-family:'Merriweather', serif;
font-size: 1.1em;
/* 25px; */
color: #256139;
padding-bottom: 10px;
}
main {
width: 100%;
margin: 0 auto;
}
.article-header {
padding-top: 8px;
font-size: 1.2em;
/* 35px; */
}
.iconContact a {
padding: 6px;
}
}
#media only screen and (max-width: 920px) {
.iconContact a {
padding: 4px;
}
}
#media only screen and (max-width: 890px) {
.header-text-below {
font-size: 1em;
/* 25px; */
}
}
#media only screen and (max-width: 860px) {
.iconContact a {
padding: 3px;
}
#media only screen and (max-width: 830px) {
.iconContact a {
padding: 2px;
}
}
#media only screen and (max-width: 800px) {
.header-text-below {
font-size: 0.9em;
/* 25px; */
}
.iconContact a {
padding: 1px;
}
#media only screen and (max-width: 890px) {
.header-text-below {
font-size: 1em;
/* 25px; */
}
}
#media only screen and (max-width: 768px) {
aside {
float: none;
width: 100%;
}
article {
width: 100%;
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A Healthy Zest; A food blog begins</title>
<link rel="stylesheet" type="text/css" href="styles/styles.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Playfair+Display:400,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Merriweather' rel='stylesheet' type='text/css'>
<!-- Responsive media queries -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<nav>
<ul>
<li>Home
</li>
<li>About
</li>
<li>Recipes
</li>
<li>Contact
</li>
</ul>
</nav>
<div class="wrapper">
<header>
<h1 class="header-text"> A Healthy Zest </h1>
<h2 class="header-text-below"> Carefully curated recipes for those on the go </h2>
</header>
<main>
<!-- Articles, left hand side -->
<article>
<header>
<div class="date-circle">May 02</div>
<h1 class="article-header">Organic Italian pizza</h1>
</header>
<!--- Image in blog post, figure -->
<figure>
<img src="images/pizza-600.jpg" alt="Delicious Italian Cheese and Tomato Pizza" width="600" height="400">
</figure>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat lectus quis tellus venenatis pellentesque. Vestibulum et aliquam ipsum. Suspendisse dapibus nibh arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed posuere urna ut tortor vulputate porttitor. Maecenas eget ultrices felis, at luctus justo. Etiam blandit placerat lacus vel tristique. Suspendisse ultrices iaculis eros sed molestie. Nulla eget ante eleifend, vulputate nunc in, congue orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin id tellus dolor. Aenean maximus eros porttitor erat consequat, vel iaculis dui faucibus. Vestibulum aliquet lorem at mi pretium ultricies. Suspendisse tempor pulvinar rutrum. Morbi consequat eget nunc id lobortis. Pellentesque ut tincidunt lectus. In hac habitasse platea dictumst. Duis gravida neque sit amet nunc vestibulum, non interdum ante dictum. Fusce semper pharetra lectus nec auctor. Sed dignissim cursus leo, et porttitor sem porta quis. Etiam facilisis volutpat neque, vitae rutrum purus fermentum vitae. Donec sed nunc dolor. Sed sed rutrum mi. Sed malesuada lobortis aliquet. Praesent vel nisl in massa dictum varius. Nullam nec magna arcu. Vivamus at dolor id neque iaculis rhoncus. Suspendisse aliquet libero felis, vitae tincidunt lectus placerat a. Duis a dictum lacus. Donec ut libero diam. Phasellus scelerisque mattis felis, ut malesuada neque pellentesque et. In arcu sem, convallis ac fermentum sed, consequat et tellus. Donec eu orci quis sapien aliquet porttitor sit amet eu metus. Etiam non sodales risus. Suspendisse placerat sem eu dolor porta tempor.</p>
<p class="read-more"> Read more...
</p>
</article>
<article>
<header>
<div class="date-circle">April 08</div>
<h1 class="article-header">Healthy whole-grain sandwich</h1>
</header>
<!--- Image in blog post, figure -->
<figure>
<img src="images/sandwich-600.jpg" alt="Healthy sandwich with lettuce, egg and cream cheese" width="600" height="400">
</figure>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat lectus quis tellus venenatis pellentesque. Vestibulum et aliquam ipsum. Suspendisse dapibus nibh arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed posuere urna ut tortor vulputate porttitor. Maecenas eget ultrices felis, at luctus justo. Etiam blandit placerat lacus vel tristique. Suspendisse ultrices iaculis eros sed molestie. Nulla eget ante eleifend, vulputate nunc in, congue orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin id tellus dolor. Aenean maximus eros porttitor erat consequat, vel iaculis dui faucibus. Vestibulum aliquet lorem at mi pretium ultricies. Suspendisse tempor pulvinar rutrum. Morbi consequat eget nunc id lobortis. Pellentesque ut tincidunt lectus. In hac habitasse platea dictumst. Duis gravida neque sit amet nunc vestibulum, non interdum ante dictum. Fusce semper pharetra lectus nec auctor. Sed dignissim cursus leo, et porttitor sem porta quis. Etiam facilisis volutpat neque, vitae rutrum purus fermentum vitae. Donec sed nunc dolor. Sed sed rutrum mi. Sed malesuada lobortis aliquet. Praesent vel nisl in massa dictum varius. Nullam nec magna arcu. Vivamus at dolor id neque iaculis rhoncus. Suspendisse aliquet libero felis, vitae tincidunt lectus placerat a. Duis a dictum lacus. Donec ut libero diam. Phasellus scelerisque mattis felis, ut malesuada neque pellentesque et. In arcu sem, convallis ac fermentum sed, consequat et tellus. Donec eu orci quis sapien aliquet porttitor sit amet eu metus. Etiam non sodales risus. Suspendisse placerat sem eu dolor porta tempor.</p>
<p class="read-more">
Read more...
</p>
</article>
<!-- Aside, right sidebar, author bio-->
<aside>
<!-- Social media icons -->
<div class="iconContact">
<a href="#">
<i class="fa fa-facebook fa-3x"></i>
</a>
</div>
<div class="iconContact">
<a href="#">
<i class="fa fa-twitter fa-3x"></i>
</a>
</div>
<div class="iconContact">
<a href="#">
<i class="fa fa-instagram fa-3x"></i>
</a>
</div>
<div class="iconContact">
<a href="#">
<i class="fa fa-pinterest fa-3x"></i>
</a>
</div>
<!-- Social media icons end -->
<figure>
<img src="images/author-300.png" alt="Picture of the author of the food blog" width="300" height="294">
</figure>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat lectus quis tellus venenatis pellentesque. Vestibulum et aliquam ipsum. Suspendisse dapibus nibh arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed posuere urna ut tortor vulputate porttitor. Maecenas eget ultrices felis, at luctus justo. Etiam blandit placerat lacus vel tristique.</p>
</aside>
<!-- Aside, right sidebar, featured posts -->
<aside>
<h1 class="featured">Featured Posts</h1>
<a href="#">
<figure>
<img src="images/smoothie-300.jpg" alt="Delicious Green Smoothie with bananas and strawberries on the side" width="300" height="200">
</figure>
</a>
<a href="#">
<figure>
<img src="images/oatmeal-300.jpg" alt="Healthy oatmeal with bananas and nuts sprinkled on top" width="300" height="200">
</figure>
</a>
</aside>
<div class="clear"></div>
</div>
<!-- end wrapper -->
</main>
<footer class="clear"></footer>
</body>
</html>
I suggest using the flexible box model to accomplish what you want.
Remove all floats.
Turn your containing element <main> into a flexbox container:
main {
display: flex;
}
Put all of your left side content into a <div id="left"> and all of your right side content into <div id="right">.
Now lets remove the grow and shrink properties from these divs:
#left, #right {
flex-grow: 0;
flex-shrink: 0;
}
Now when you want to use a mobile layout, you can have your media queries set flex-direction: column; and flex-grow: 1; and your right side content will drop down underneath your left side content.
You will probably need to move some of your attributes that you gave to each article and aside into their respective left/right column tag.
Here is a jsfiddle
This is a great reference for flexboxes.
Im trying to re-create my mockup from photoshop in code. I've managed to get all elements in the page.
I want a picture and then to have to text directly to the right of it.
Any CSS help would be amazing, thank you in advance!
HTML
<h1>About Me</h1>
<div id="about">
<img src="images/me.png" class="meimage">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc lectus tortor, sodales ac velit sit amet, imperdiet posuere risus. Nam congue volutpat vehicula. Sed convallis tempor orci vitae aliquam. Quisque at faucibus eros. Sed laoreet, orci et ultricies luctus, turpis leo pharetra felis, ac tristique ligula nisl id enim. Nullam porta quam et dolor eleifend placerat. Aenean rhoncus, tellus ut sodales suscipit, nunc enim ornare dui, cursus tincidunt urna nisl vitae lacus. Nunc tincidunt auctor dolor, eget laoreet justo gravida vel. In convallis arcu massa, quis gravida purus vestibulum eget.
</div>
CSS
.meimage{
margin: 20px 20px 20px 20px;
height:200px;
width:200px;
}
#about{
text-align: center;
width:800px;
text-shadow:0 -1px 1px rgba(0,0,0,0.6);
font-family: 'Verdana', sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Cantarell', sans-serif;
font-weight:700;}
h1{
display: block;
padding: 0px 155px;
font-family: 'Cantarell', sans-serif;
text-shadow:0 -1px 1px rgba(0,0,0,0.6);
}
You can use CSS float to wrap text around an image. Though I'd say it looks a little strange with the text centered:
.meimage {
float:left;
margin:0 1em 1em 0;
}
http://jsfiddle.net/SJTDS/1/
Edit
If this is a static page and the content won't be changing, you can probably just update the padding on your <h1> to get it to align with the image.
h1 {
...
padding: 0px 20px;
}
http://jsfiddle.net/SJTDS/4/
Keep in mind that fixed pixel settings can be fragile and break when, for instance, you upload a larger image.
If this is an issue, I'd use a different structure.
.meimage, #about {
float: left;
}
Edit: You wanted header floated left too:
.col {
float: left;
margin: ...;
}
<div class="col"><h1>About Me</h1><img ... /></div>
<div class="col"><p>Lorem Ipsum...</p></div>
in my CSS example I've created a horizontal menu with 50px height. Also tried to use a sticky footer but the BODY is longer with the height of the top menu, and because of it a 50px big white place appeared on the bottom of the page under the Footer. [The problem exists on IE10. Not tested in other browsers yet.]
JSFiddle
html file:
<!doctype html>
<html>
<head>
<!-- Load jQuery from Google's CDN -->
<script src="jquery-1.9.1.js"></script>
<!-- Source our javascript file with the jQUERY code -->
<script src="script.js"></script>
<link rel="stylesheet" href="runnable.css" />
</head>
<body>
<div id="header">
<div id="headerline">
<div class="wrapper">
<ul class="navigation">
<li class="logo">
WebApp
</li>
<li class="tmenu">
<span class="menuItem">Site Events</span>
<ul class="smenu">
<li><span>Consulting</span></li>
<li><span>Sales</span></li>
<li><span>Support</span></li>
</ul>
</li>
<li class="tmenu">
<span class="menuItem">Text files</span>
<ul class="smenu">
<li>Company</li>
<li>Mission</li>
<li>Contact Information</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="content">
<div class="wrapper">
<div class="contentbox">
<h1>Welcome Message</h1>
<p class="date">3/31/2014 - 4:37 PM</p>
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel dui tempus, iaculis arcu sit amet, porttitor turpis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed eu quam mi. Morbi ac nulla eget diam commodo faucibus. Proin dignissim elit a ligula rhoncus, vitae viverra justo dignissim. In congue quam molestie, mollis ante sed, viverra urna. Pellentesque massa velit, eleifend a magna nec, vulputate gravida dui. Integer pulvinar id arcu ut faucibus. Phasellus vitae augue ac eros sollicitudin vehicula. Nunc aliquam leo a laoreet consequat. Fusce tristique mauris sed neque feugiat, id dignissim dui bibendum. Ut hendrerit commodo mi. Nunc pharetra, eros ut ultricies ultricies, erat lectus vehicula odio, vel suscipit odio nisi eu tellus. Integer interdum adipiscing gravida. Donec vitae neque diam. Mauris interdum eu nulla nec interdum.</p>
<p class="text">Vivamus eu quam ut felis hendrerit mattis ac nec urna. Maecenas erat felis, gravida ut porttitor at, congue eget mauris. Phasellus interdum dolor sem, et gravida massa scelerisque ac. Pellentesque non rhoncus orci. Quisque viverra tellus justo, eu congue mi mattis eget. Fusce a nulla urna. Fusce et mauris eget lorem lacinia sollicitudin. Fusce condimentum neque quis est tristique,aliquet dui sodales.</p>
<p class="text">Donec at velit nec nibh porttitor auctor quis non ipsum. Vestibulum condimentum viverra mattis. Praesent sed quam ultricies magna tempor tristique. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed venenatis nulla eget sapien hendrerit vulputate. Donec sed libero justo. Aliquam diam felis, feugiat ac vulputate vel, iaculis at lorem. Nam facilisis lacus nec turpis bibendum, sit amet rutrum eros ultrices. </p>
<p class="text">Quisque quis scelerisque risus. Fusce a lacinia velit, non vestibulum ipsum. Donec nunc ipsum, semper quis sagittis nec, facilisis id felis. Morbi eget magna volutpat, adipiscing dui ac, elementum est. Curabitur sem diam, rhoncus in lorem eu, sodales eleifend sem. Etiam bibendum convallis fermentum. Donec ullamcorper pulvinar neque in auctor. Vestibulum tincidunt arcu vel orci molestie porta. Quisque quis commodo velit, eget vulputate nibh. Cras eu venenatis tellus. </p>
<p class="text">Duis ultricies accumsan euismod. Nulla pulvinar felis placerat vehicula rutrum. Etiam placerat vitae lacus nec laoreet. In nunc nibh, tincidunt sed dictum sit amet, ultrices vel enim. Nulla in urna molestie, pulvinar massa non, consectetur augue. Ut et ligula vitae libero vehicula mollis. Suspendisse nisl felis, pretium eget libero in, pharetra porttitor lectus. Nunc tincidunt nunc neque. Donec eget interdum ante. Pellentesque vehicula sapien eu lectus tempus interdum. Suspendisse pharetra purus id lectus cursus dapibus. Proin sed lorem dignissim, placerat est sit amet, blandit diam. Ut ut risus vitae neque sodales rhoncus nec ac massa. Fusce ac augue tincidunt, vulputate augue sit amet, varius tellus. Vivamus a tortor ipsum. Vestibulum in tellus neque.</p>
</div>
</div>
</div>
<div id="footer">
<div id="fback">
<div class="wrapper">
<div id="fContent">
<ul><p>Help</p>
<li>About WebApp</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
<ul><p>FAQ</p>
<li>Question</li>
<li>Question</li>
<li>Question</li>
</ul>
<ul><p>Contacts</p>
<li>Person</li>
<li>Person</li>
<li>Person</li>
<li>Person</li>
<li>Person</li>
<li>Person</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
CSS file:
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
/*border: 2px solid red;*/
}
body {
font-family: arial;
text-align: center;
background:url(foo) fixed;
height: 100%;
/*border: 2px solid red;*/
}
div.wrapper {
width: 1100px;
margin: 0 auto;
padding: 0;
}
/*=== header ===*/
div#header {
text-align: center;
position: fixed;
_position: absolute;
top: 0;
left: 0;
_top:expression(eval(document.body.scrollTop));
display: block;
width: 100%;
}
div#headerline {
padding: 0;
margin: 0;
background: #e6e6e6;
height: 50px;
border-bottom: solid 1px #172740;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
ul.navigation li{
float: left;
}
ul.navigation a {
text-decoration: none;
display: block;
}
span.menuItem {
display: inline;
display: inline-table;
display: inline-block;
line-height: 68px;
}
li.logo {
font-family: tahoma;
font-size: 40px;
font-weight: bold;
}
li.logo a {
padding: 0;
height: 50px;
width: 180px;
text-align: left;
}
li.tmenu {
float: left;
width: 160px;
position: relative;
}
li.logo a, li.tmenu > a { /* ">" means the first level of this type of children*/
color: #172740;
text-shadow: 2px 2px white;
}
li.tmenu a {
width: 160px;
height: 50px;
}
li.tmenu > a {
font-weight: 600;
}
li.tmenu > a:hover {
font-weight: 900;
}
ul.smenu {
display: none;
position: absolute;
margin-left: 0px;
list-style: none;
padding: 0px;
background: #172740;
border: solid 1px #000;
}
ul.smenu, ul.smenu li {
width: 160px;
float: left;
}
ul.smenu a {
display: block;
height: 20px;
padding: 8px 0px;
color: #fff;
text-decoration: none;
text-align: center;
text-shadow: 1px 1px #000;
}
ul.smenu a:hover {
font-weight: bold;
}
/*=== content ===*/
div#content {
text-align: left;
/*position: relative;*/
min-height: 60%;
margin-top: 50px;
}
h1 {
padding: 0;
margin: 0;
padding-top: 50px;
color: #253e66;
font-size: 25px;
}
p.date {
font-size: 8px;
color: #aaa;
}
p.text {
font-size: 14px;
margin-bottom: 6px;
}
/*=== Footer ===*/
div#footer {
padding-top: 50px;
width: 100%;
min-height: 20%;
}
div#fback {
overflow: hidden;
padding: 0;
margin: 0;
background: #253e66;
text-align: center;
}
div#fContent {
color: #e6e6e6;
text-align: center;
}
div#fContent ul {
text-align: left;
float: left;
padding: 40px 70px 50px 0px;
font-size: 14px;
}
div#fContent ul > p {
font-weight: bold;
padding-bottom: 12px;
}
div#fContent li {
padding-bottom: 3px;
}
/*=== Copyright content ===*/
JS file:
$(document).ready(
/* This is the function that will get executed after the DOM is fully loaded */
function () {
/* Next part of code handles hovering effect and submenu appearing */
$('.tmenu').hover(
function () { //appearing on hover
$('ul', this).fadeIn();
},
function () { //disappearing on hover
$('ul', this).fadeOut();
}
);
}
);
Also weird that, if I set a border on the BODY, big part of the white space is disappear. Please help me out, what I've messed in the CSS, and how can I repair my code. Thanks a lot in advance.
sorry the was indeed a problem didnt understand the question.
I changed div#fContent ul from:
div#fContent ul {
text-align: left;
float: left;
padding: 40px 70px 50px 0px;
font-size: 14px;
}
to:
div#fContent ul {
text-align: left;
float: left;
padding: 40px 70px 0px 0px;
font-size: 14px;
}
Good luck. Check the fiddle and let me know:
DEMO
don't quote me on this please... but I think that the the paragraph element gives white space so to remove this make its margin 0px. Hope it's the right answer if not please comment back MontyX. thanks