I'm trying to make a page with text floated left and the image floated right. I accomplished that, but my webpage images and text need to be able to properly resize. and width in css aren't working for me, unlike in my home page, so I was wondering if anyone could fix it.
<section>
<div id="right">
<img src="../img/placeholder.png" alt="Photo of --">
<p>--</p>
</div>
<p id="left">Web and Graphic Designer beginner,<wbr>blah blah.</p>
</section>
and the css (I included all of it just in case, but the most relevant part is the bottom PAGE PORTFOLIO):
/*ABOUT CSS*/
/*GENERAL*/
body {
}
ul {
list-style: none;
}
/*section*/
section {
max-width: 940px;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 300;
margin: 0 auto;
padding: 0;
color: gray;
}
/*all styling*/
* {
background-color: #f2f2f2;
}
/*all links*/
a {
text-decoration: none;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 300;
color: gray;
}
/*visited links and hover links*/
a:visited {
color: #838383;
}
a:hover {
font-size:105%;
}
/*HEADING*/
/*header*/
h1 {
text-align: center;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 700;
line-height: 0.5em;
color: #8c8c8c;
width: 100%;
}
/*subhead*/
h2 {
text-align: center;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 700;
color: #8c8c8c;
width: 100%;
}
/*NAVIGATION*/
nav {
text-align: center;
padding: 10px 0;
}
/*horizontal nav*/
nav li {
display: inline;
}
nav a {
display: inline-block;
padding: 2% 2%;
}
/*FOOTER*/
footer {
font-size:0.75em;
text-align: center;
clear: both;
}
/*social media*/
footer {
text-align: center;
margin: 0 5px;
padding: 15px 15px;
}
#twitter img {
width: 46px;
height: 37px;
margin: 0 auto;
padding: 15px 15px;
}
#facebook img {
width: 40px;
height: 40px;
margin: 0 auto;
padding: 15px 15px;
}
/*PAGE PORTFOLIO*/
#right {
float: right;
width: 40%;
height: 40%;
}
#left {
float: left;
}
What's wrong here
Used your code except for:
p+img {
width:50px;
height:50px;
text-wrap:true;
float:left;
}
which is for extra text
Related
I have the following design:
Notice the signature on the bottom under the quotation. Its very nicely placed on the right aligned with the text.
Here is my html css version so far:
I'm having trouble figuring out the correct way to get the signature over to the right and aligned with the right of the quotation.
Here is my html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="header">
<div class="logo">
<img src="images/top-logo.png" alt="ProvenWord Logo">
</div>
<ul class="nav">
<li>Home</li>
<li>Proofreading</li>
<li>Editing</li>
<li>About</li>
<li>How it works</li>
<li>FAQ</li>
<li>Contact</li>
</ul>
</div> <!--close header -->
<div class="tagline">
<div class="section-container">
<h1><span>Transform your written</span> work into a <strong>masterpiece<strong></h1>
Free Quote
<p class="first-quote">"Your proofreading assistance has enabled me to successfully complete my dissertation with greater ease."</p>
<img src="images/sudthida-signature.png" alt="Sudthida's Signature">
<p class="first-quote school">Sudthida P. Ph.D in Educational Research - King's College University of London</p>
</div><!--close section-container-->
</div><!--close tagline-->
</body>
</html>
Here is my css:
html, body, h1, h2, h3, h4, p, ol, ul, li, a, div {
padding: 0px;
border: 0px;
margin: 0px;
font-size: 100%;
font: inherit;
}
/*----------------------------*/
/*----- Tag Declarations -----*/
/*--------------------------- */
body {
font-family: "Sinkin Sans", Verdana, Helvetica, sans-serif;
}
h1{
font-size: 36px;
font-weight: 400;
line-height: 1.2;
}
h2 {
font-size: 28px;
padding-bottom: 25px;
font-weight: 300;
line-height: 1.3;
letter-spacing: 1px;
}
h2 strong {
font-weight: 600;
}
p {
font-size: 15px;
line-height: 140%;
font-weight: 300;
letter-spacing: 1px;
}
.button {
display: inline-block;
line-height: 48px; /*setting this to the button height makes the text centered */
height: 48px;
width: 185px;
background: #ffd000;
border: 2px solid #b59400;
font-size: 18px;
font-weight: 100;x;
border-radius: 60px;
}
a.button {
text-decoration: none;
color: #000000;
}
a.button:hover {
background: #feef00;
}
li {
list-style: none;
margin-bottom: 0.5em;
text-indent: 1.5em;
background-image: url(images/check.png);
background-repeat: no-repeat;
letter-spacing: 1px;
font-weight: 200;
font-size: 12px;
}
.section-container {
width: 520px;
margin: 0 auto;
}
/*--------------------------*/
/*----- Header Section -----*/
/*--------------------------*/
.header {
padding: 25px 0px 32px 48px;
}
.logo img {
float: left;
padding-right: 130px;
}
.nav {
list-style-type: none;
padding-top: 32px;
}
.nav li {
display: inline;
padding-right: 10px;
font-size: 12px;
font-weight: 200;
}
/*---------------------------*/
/*----- Tagline Section -----*/
/*---------------------------*/
.tagline {
background: #abdfe8 url(images/bg-tagline.png) no-repeat;
height: 450px;
text-align: center;
}
.section-container h1 {
padding-top: 130px;
}
.section-container h1 span {
letter-spacing: 2px;
}
.section-container .button {
margin: 40px 0 40px 0;
}
.first-quote {
font-size: 13px;
line-height: 1.5;
color: white;
margin: 0 25px 10px 25px;
}
.section-container img {
display: block;
text-align: right;
}
.section-container .school {
font-size: 10px;
letter-spacing: 0.5px;
text-align: center;
}
I have used the margin property to move the image over but I thought margins were used to create space between block elements. I don't want to hack my way to the layout, I want to understand how this works and what is the correct way to use the different properties in css.
Any help much appreciated.
You can use float to align the image to the right, combined with margin to place it exactly where needed, then just clear the text below the image.
I've commented the changes in your CSS below.
html,
body,
h1,
h2,
h3,
h4,
p,
ol,
ul,
li,
a,
div {
padding: 0px;
border: 0px;
margin: 0px;
font-size: 100%;
font: inherit;
}
/*----------------------------*/
/*----- Tag Declarations -----*/
/*--------------------------- */
body {
font-family: "Sinkin Sans", Verdana, Helvetica, sans-serif;
}
h1 {
font-size: 36px;
font-weight: 400;
line-height: 1.2;
}
h2 {
font-size: 28px;
padding-bottom: 25px;
font-weight: 300;
line-height: 1.3;
letter-spacing: 1px;
}
h2 strong {
font-weight: 600;
}
p {
font-size: 15px;
line-height: 140%;
font-weight: 300;
letter-spacing: 1px;
}
.button {
display: inline-block;
line-height: 48px;
/*setting this to the button height makes the text centered */
height: 48px;
width: 185px;
background: #ffd000;
border: 2px solid #b59400;
font-size: 18px;
font-weight: 100;
x;
border-radius: 60px;
}
a.button {
text-decoration: none;
color: #000000;
}
a.button:hover {
background: #feef00;
}
li {
list-style: none;
margin-bottom: 0.5em;
text-indent: 1.5em;
background-image: url(images/check.png);
background-repeat: no-repeat;
letter-spacing: 1px;
font-weight: 200;
font-size: 12px;
}
.section-container {
width: 520px;
margin: 0 auto;
}
/*--------------------------*/
/*----- Header Section -----*/
/*--------------------------*/
.header {
padding: 25px 0px 32px 48px;
}
.logo img {
float: left;
padding-right: 130px;
}
.nav {
list-style-type: none;
padding-top: 32px;
}
.nav li {
display: inline;
padding-right: 10px;
font-size: 12px;
font-weight: 200;
}
/*---------------------------*/
/*----- Tagline Section -----*/
/*---------------------------*/
.tagline {
background: #abdfe8 url(images/bg-tagline.png) no-repeat;
height: 450px;
text-align: center;
}
.section-container h1 {
padding-top: 130px;
}
.section-container h1 span {
letter-spacing: 2px;
}
.section-container .button {
margin: 40px 0 40px 0;
}
.first-quote {
font-size: 13px;
line-height: 1.5;
color: white;
margin: 0 25px 10px 25px;
}
.section-container img {
display: block;
float: right; /* USE FLOAT */
margin-right: 1.8em; /* WITH MARGIN TO GIVE THE CORRECT POSITION */
}
.section-container .school {
clear: both; /* CLEAR THE FLOATED IMAGE */
font-size: 10px;
letter-spacing: 0.5px;
text-align: center;
}
<div class="header">
<div class="logo">
<img src="images/top-logo.png" alt="ProvenWord Logo">
</div>
<ul class="nav">
<li>Home</li>
<li>Proofreading</li>
<li>Editing</li>
<li>About</li>
<li>How it works</li>
<li>FAQ</li>
<li>Contact</li>
</ul>
</div>
<!--close header -->
<div class="tagline">
<div class="section-container">
<h1><span>Transform your written</span> work into a <strong>masterpiece<strong></h1>
Free Quote
<p class="first-quote">"Your proofreading assistance has enabled me to successfully complete my dissertation with greater ease."</p>
<img src="images/sudthida-signature.png" alt="Sudthida's Signature">
<p class="first-quote school">Sudthida P. Ph.D in Educational Research - King's College University of London</p>
</div>
<!--close section-container-->
</div>
<!--close tagline-->
Please help!
I tried many tricks to remove the white space under my footer but none of them solved my problem. I noticed that the white space is only visible in the pages with text, p and h1 tags. Any help is highly appreciated.
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Olive Green Studio</title>
<link href="oliva.css" rel="stylesheet" type="text/css" />
<!—[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]—>
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<body class="twoColFixLtHdr">
<div id="container">
<div id="header"><!-- end #header -->
<div id="logo">
<a href="index.html">
<img src="olivaimages/olivegreenlogoweb.png" border="none"/>
</a>
</div>
<div id="sidebar1">
<ul>
<li>Home</li>
<li>Work</li>
<li>About</li>
<li>Contact</li>
</ul>
<!-- end #sidebar1 --></div>
</div>
<div id="mainContent">
<h1>Contact Us </h1>
<p>If you need a creative help or want to take your project to the next level please don't hesitate to drop us a line.</p>
<a class="worklinks" href= "mailto:info#olivegreenstudio.com"> info#olivegreenstudio.com</a>
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div class="clearfooter"></div>
<!-- end #container -->
</div>
<div id="footerframe">
<div id="footer">
<div id="footer2">
<div id="address">Khobar<br> Saudi Arabia </div>
<div id="contact">
<strong>Services:</strong><br> Logos<br>Branding<br>Identity<br>Collaterals<br>Packaging<br> Web Design & Development <br>
</div>
<div id="email">
If you have a project inquiry, we will be happy to answer you <a class="contactlink" href="mailto:info#olivegreenstudio.com"> here.</a>
</div>
<div class="social">
<div class="twitter">
<a href="https://twitter.com/OliveGreenSTU" />
<img src="olivaimages/twitterbirdwebgreen.png" onmouseover="this.src='olivaimages/twitterbirdweb-lightgreen.png'" onmouseout="this.src='olivaimages/twitterbirdwebgreen.png'" />
</div>
</a>
<div id="pinterest">
<a href="http://pinterest.com/olivegreenstu/">
<img src="olivaimages/pinterestwebgreen.png" onmouseover="this.src='olivaimages/pinterestweb-lightgreen.png'"
onmouseout="this.src='olivaimages/pinterestwebgreen.png'" />
</a>
</div>
<div class="copywrite"> © 2013 Olive Green. All rights reserved.</div>
</div>
</div>
</div>
</div>
</body>
</html>
CSS:
#charset "UTF-8";
body {
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
background-color: #FFFFFF;
height: 100%;
}
.twoColFixLtHdr #header {
height: 170px;
background-color: #FFFFFF;
background-repeat: no-repeat;
background-position: center center;
margin: 0px;
padding: 0;
}
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #5A6219;
text-decoration: none;
font-style: normal;
font-weight: normal;
padding-bottom: 20px;
}
h2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: normal;
color: #908B23;
text-decoration: none;
line-height: 1.5em;
margin-bottom: 30px;
}
p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 1.5em;
font-weight: normal;
color: #908B23;
text-decoration: none;
margin: 0px;
}
.twoColFixLtHdr #container {
width: 900px;
text-align: left; /* this overrides the text-align: center on the body element. */
min-height: 100%;
margin-top: 0;
margin-right: auto;
margin-left: auto;
position: relative;
margin-bottom: -215px;
height: 100%;
}
.twoColFixLtHdr #mainContent {
height: 100%;
background-color: #FFF;
float: left;
width: 100%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCC;
padding-top: 50px;
padding-bottom: 70px;
}
.workmaincontent {
height: 100%;
background-color: #FFF;
float: left;
width: 100%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCC;
padding-top: 50px;
padding-bottom: 70px;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
.twoColFixLtHdr #sidebar1 {
float: right; /* since this element is floated, a width must be given */
width: 300px;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 15px;
padding-left: 20px;
margin-top: 70px;
background-color: #FFFFFF;
height: 30px;
}
#sidebar1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
height: 200px;
line-height: 1.5em;
text-decoration: none;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
width: 500px;
}
#sidebar1 ul {
background-color: #FFFFFF;
list-style-type: none;
margin: 0px;
padding: 0px;
}
#sidebar1 li {
display: run-in;
list-style-type: none;
}
#sidebar1 a {
display: run-in;
text-decoration: none;
color: #918C10;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
padding: 5px;
float: left;
width: 65px;
}
#sidebar1 a:hover {
color: #5A6219;
}
.worklinks{
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.worklinks:hover{
font-family: Arial, Helvetica, sans-serif;
color: #908B23;
text-decoration: none;
}
#print{
height: 100%;
background-color: #FFF;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
margin-right: 85px;
}
#web{
height: 100%;
background-color: #FFF;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
margin-top: 50px;
margin-bottom: 50px;
}
#packaging{
background-color: #FFF;
height: 100%;
width: 730px;
float: left;
padding-right: 15px;
padding-left: 15px;
margin-left: 85px;
}
.imagetitles a {
text-decoration: none;
font-family: "Century Gothic";
font-size: 25px;
font-style: normal;
font-weight: normal;
color: #00CCCC;
}
#printtitle{
bottom: -5px;
left: 333px;
}
#webtitle{
position: absolute;
left: 333px;
top: 521px;
}
#packagingtitle{
position: absolute;
left: 317px;
top: 823px;
width: 89px;
}
#bigimages{
width: 570px;
height: 100%;
}
.imagestalk {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
font-size: 14px;
line-height: 1.5em;
padding-top: 5px;
padding-right: 15px;
padding-bottom: 10px;
padding-left: 20px;
}
.thumbnails {
border: 5px solid #666666;
}
h3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 1.5em;
font-weight: normal;
color: #5A6219;
text-decoration: none;
}
h3 a:link {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000000;
font-style: normal;
font-weight: normal;
text-decoration: none;
}
h3 a:visited {
color: #D0BA0B;
text-decoration: underline;
}
h3 a:hover {
color: #5A6219;
}
h3 a:active {
color: #579835;
}
.back{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
padding-left: 520px;
}
.back a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 14px;
font-style: normal;
font-weight: normal;
color: #666666;
}
.back a:visited {
color: #666666;
text-decoration: none;
}
.back a:hover {
color: #000000;
text-decoration: none;
}
.back a:active {
color: #333333;
text-decoration: none;
}
.source{
font-size: 15px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
.workimage {
height: 150px;
width: 200px;
float: left;
margin: 20px;
}
img {
border: 0;
}
#logo {
height: 150px;
width: 300px;
float: left;
}
#footerframe {
width: 100%;
background-color: #AEA03A;
height: 215px;
position: relative;
float: right;
}
#footer {
width: 900px;
font-family: Verdana, Arial, Helvetica;
font-size: 11px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-decoration: none;
margin-right: auto;
margin-left: auto;
background-color: #AEA03A;
float: none;
position: relative;
height: 215px;
}
#footer2 {
width: 100%;
background-color: #AEA03A;
padding-top: 30px;
float: left;
position: relative;
}
#address {
height: 50px;
width: 180px;
background-color: #AEA03A;
float: left;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-decoration: none;
color: #5A6219;
line-height: 1.5em;
}
#contact {
height: 130px;
width: 180px;
background-color: #AEA03A;
float: left;
text-align: left;
margin-right: 180px;
margin-left: 180px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #5A6219;
text-decoration: none;
line-height: 18px;
}
#email {
background-color: #AEA03A;
height: 50px;
width: 180px;
float: right;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #5A6219;
text-decoration: none;
}
.social {
background-color: #AEA03A;
height: 35px;
width: 100%;
float: right;
margin-top: 20px;
}
#pinterest {
height: 20px;
width: 20px;
float: left;
background-repeat: no-repeat;
margin-left: 15px;
margin-bottom: 15px;
}
.twitter {
height: 20px;
width: 20px;
background-repeat: no-repeat;
float: left;
margin-bottom: 15px;
}
.copywrite {
font-size: 11px;
font-weight: lighter;
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
text-align: right;
width: 300px;
background-color: #AEA03A;
float: right;
height: 15px;
color: #5A6219;
vertical-align: middle;
margin-bottom: 10px;
margin-top: 5px;
}
.contactlink {
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.contactlink a {
font-family: Arial, Helvetica, sans-serif;
color: #5A6219;
text-decoration: none;
}
.contactlink:hover {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
text-decoration: none;
}
h4 {
color: #5A6219;
}
.indeximg {
height: 100px;
width: 900px;
background-repeat: no-repeat;
background-position: center top;
background-image: url(../olivaimages/indeximg.png)
}
.indexwrap {
height: 100%;
width: 810px;
padding-left: 90px;
}
#wrapper {
min-height: 100%;
}
.clearfooter {
height: 215px;
clear: both;
}
try this
#footerframe {
background-color: #AEA03A;
bottom: 0;
float: right;
height: 223px;
position: absolute;
width: 100%;
}
Replacing the footers 900px with 100% should do the trick.
I think you'll need implement a sticky footer technics by setting html,body height to 100% and
setting id#container as the following:
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#container {
height: auto !important;
min-height: 100%;
height: 100%;
}
example
I want to build a web responsive website with tapestry, I add the meta data in the head section of the .tml file and used the css for the responsive design. However it doesn't work at all. I tested with an elastic youtube video, which should match the width of the page. I post here the .tml file and the css.
The .tml file:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link href="${context:layout/normalize.css}" rel="stylesheet" type="text/css"/>
<title>${title}</title>
</head>
<body>
<!-- start header -->
<div class="header">
<div class="logo">
<h1>
<t:pagelink page="index">com.example:tutorial1</t:pagelink>
version ${appVersion}
</h1>
</div>
<div class="menu">
<ul>
<li t:type="loop" source="pageNames" value="pageName" class="prop:classForPageName">
<t:pagelink page="prop:pageName">${pageName}</t:pagelink>
</li>
</ul>
</div>
<div class="video-container">
<iframe width="560" height="315" src="http://www.youtube.com/embed/R800WcsFj0U" frameborder="0"></iframe>
</div>
</div>
<!-- end header -->
<!-- start page -->
<div class="page">
<!-- start sidebar -->
<div class="sidebar">
<ul>
<li class="search" style="background: none;">
</li>
<li>
<t:alerts/>
</li>
<li t:type="if" test="sidebar">
<h2>${sidebarTitle}</h2>
<div class="sidebar-content">
<t:delegate to="sidebar"/>
</div>
</li>
</ul>
</div>
<!-- end sidebar -->
<!-- start content -->
<div class="content">
<div class="post">
<div class="title">
<h2>${title}</h2>
</div>
<div class="entry">
<t:body/>
</div>
</div>
</div>
<!-- end content -->
<br style="clear: both;"/>
</div>
<!-- end page -->
<!-- start footer -->
<div class="footer">
<p class="legal">
©2012 com.example. All Rights Reserved.
•
Design by
Free CSS Templates
•
Icons by
FAMFAMFAM.
</p>
</div>
<!-- end footer -->
</body>
</html>
The css file:
body {
margin: 0;
padding: 0;
background: #FFFFFF url(images/img01.jpg) repeat-x;
text-align: justify;
font: 15px Arial, Helvetica, sans-serif;
color: #626262;
}
form {
margin: 0;
padding: 0;
}
input {
padding: 5px;
background: #FEFEFE url(images/img13.gif) repeat-x;
border: 1px solid #626262;
font: normal 1em Arial, Helvetica, sans-serif;
}
h1, h1 a, h2, h2 a, h3, h3 a {
margin: 0;
text-decoration: none;
font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
font-weight: normal;
color: #444444;
}
h1 {
letter-spacing: -1px;
font-size: 2.2em;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h2 {
letter-spacing: -1px;
font-size: 2em;
}
h3 {
font-size: 1em;
}
p, ol, ul {
margin-bottom: 2em;
line-height: 200%;
}
blockquote {
margin: 0 0 0 1.5em;
padding-left: 1em;
border-left: 5px solid #DDDDDD;
}
a {
color: #1692B8;
}
a:hover {
text-decoration: none;
}
/* Header */
div.header {
height: 42px;
}
div.logo h1, div.logo p {
float: left;
text-transform: lowercase;
}
div.logo h1 {
padding: 0px 0 0 40px;
}
div.logo p {
margin: 0;
padding: 14px 0 0 4px;
line-height: normal;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
div.logo a {
text-decoration: none;
color: #D0C7A6;
}
div.menu {
float: right;
}
div.menu ul {
margin: 0;
padding: 0;
list-style: none;
}
div.menu li {
display: block;
float: left;
height: 42px;
}
div.menu a {
display: block;
padding: 8px 20px 0px 20px;
text-decoration: none;
text-align: center;
text-transform: lowercase;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
font-size: 14px;
color: #CEC5A4;
}
div.menu .last {
margin-right: 20px;
}
div.menu a:hover {
color: #FFFFFF;
}
div.menu .current_page_item A {
text-decoration: underline;
}
div.menu .current_page_item a {
}
/* Page */
div.page {
padding: 40px 40px 0 40px;
}
/* Content */
div.content {
margin-right: 340px;
}
.post {
margin-bottom: 10px;
}
.post .title {
border-bottom: 1px #999999 dashed;
font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
}
.post .title h2 {
padding: 30px 30px 0 0px;
text-transform: lowercase;
font-weight: normal;
font-size: 2.2em;
}
.post .title p {
margin: 0;
padding: 0 0 10px 0px;
line-height: normal;
color: #BABABA;
}
.post .title p a {
color: #BABABA;
}
.post .entry {
padding: 20px 0px 20px 0px;
}
.post .links {
margin: 0;
padding: 0 30px 30px 0px;
}
.post .links a {
display: block;
float: left;
margin-right: 10px;
margin-bottom: 5px;
text-align: center;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}
.post .links a:hover {
}
.post .links .more {
width: 128px;
height: 30px;
background: url(images/img03.jpg) no-repeat left center;
}
.post .links .comments {
width: 152px;
height: 30px;
background: url(images/img04.jpg) no-repeat left center;
}
/* Sidebar */
div.sidebar {
float: right;
width: 300px;
margin-top: 30px;
}
div.sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
div.sidebar li {
margin-bottom: 10px;
background: url(images/img10.gif) no-repeat left bottom;
}
div.sidebar li ul {
padding: 0 30px 40px 30px;
}
div.sidebar li li {
margin: 0;
padding-left: 20px;
}
div.sidebar h2 {
padding: 30px 30px 5px 10px;
background: url(images/img09.gif) no-repeat;
text-transform: lowercase;
font-weight: normal;
font-size: 1.6em;
color: #302D26;
}
div.sidebar DIV.sidebar-content {
width: 265px;
margin-left: 10px;
padding-bottom: 1px;
}
div.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
div.video-container iframe,
div.video-container object,
div.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* Search */
li.search {
padding: 20px 30px 40px 30px;
}
li.search input {
padding: 0;
width: 70px;
height: 29px;
background: #DFDFDF url(images/img14.gif) repeat-x;
font-weight: bold;
}
li.search #s {
padding: 5px;
width: 150px;
height: auto;
background: #FEFEFE url(images/img13.gif) repeat-x;
border: 1px solid #626262;
font: normal 1em Arial, Helvetica, sans-serif;
}
li.search br {
display: none;
}
/* Categories */
div.sidebar div.categories li {
background: url(images/img12.gif) no-repeat left center;
}
/* Calendar */
div.calendar_wrap {
padding: 0 30px 40px 30px;
}
div.calendar table {
width: 100%;
text-align: center;
}
div.calendar thead {
background: #F1F1F1;
}
div.calendar tbody td {
border: 1px solid #F1F1F1;
}
div.calendar #prev {
text-align: left;
}
div.calendar #next {
text-align: right;
}
div.calendar tfoot a {
text-decoration: none;
font-weight: bold;
}
div.calendar #today {
background: #FFF3A7;
border: 1px solid #EB1400;
font-weight: bold;
color: #EB1400
}
/* Footer */
div.footer {
padding: 70px 0 50px 0;
background: #757575 url(images/img08.gif) repeat-x;
}
div.footer p {
margin-bottom: 1em;
text-align: center;
line-height: normal;
font-size: .9em;
color: #BABABA;
}
div.footer a {
padding: 0 20px;
text-decoration: none;
color: #DDDDDD;
}
div.footer a:hover {
color: #FFFFFF;
}
div.footer .rss {
background: url(images/img18.gif) no-repeat left center;
}
div.footer .xhtml {
background: url(images/img19.gif) no-repeat left center;
}
div.footer .css {
background/*Styles for screen 600px and lower*/
#media screen and (max-width: 600px) {
nav {
height: auto;
}
nav ul {
width: 100%;
display: block;
height: auto;
}
nav li {
width: 50%;
float: left;
position: relative;
}
nav li a {
border-bottom: 1px solid #576979;
border-right: 1px solid #576979;
}
nav a {
text-align: left;
width: 100%;
text-indent: 25px;
}
}
/*Styles for screen 515px and lower*/
#media only screen and (max-width : 480px) {
nav {
border-bottom: 0;
}
nav ul {
display: none;
height: auto;
}
nav a#pull {
display: block;
background-color: #283744;
width: 100%;
position: relative;
}
nav a#pull:after {
content:"";
background: url('nav-icon.png') no-repeat;
width: 30px;
height: 30px;
display: inline-block;
position: absolute;
right: 15px;
top: 10px;
}
}
div.footer .legal a {
padding: 0;
}
/*Styles for screen 600px and lower*/
#media screen and (max-width: 600px) {
nav {
height: auto;
}
nav ul {
width: 100%;
display: block;
height: auto;
}
nav li {
width: 50%;
float: left;
position: relative;
}
nav li a {
border-bottom: 1px solid #576979;
border-right: 1px solid #576979;
}
nav a {
text-align: left;
width: 100%;
text-indent: 25px;
}
}
/*Styles for screen 515px and lower*/
#media only screen and (max-width : 480px) {
nav {
border-bottom: 0;
}
nav ul {
display: none;
height: auto;
}
nav a#pull {
display: block;
background-color: #283744;
width: 100%;
position: relative;
}
nav a#pull:after {
content:"";
background: url('nav-icon.png') no-repeat;
width: 30px;
height: 30px;
display: inline-block;
position: absolute;
right: 15px;
top: 10px;
}
}
/*Smartphone*/
#media only screen and (max-width : 320px) {
nav li {
display: block;
float: none;
width: 100%;
}
nav li a {
border-bottom: 1px solid #576979;
}
}
Thank you very much.
You are missing a closing brace. It goes between the 2nd and 3rd line below.
div.footer .css {
background/*Styles for screen 600px and lower*/
#media screen and (max-width: 600px) {
As Lee Meador already pointed out you are missing the closing braces for your footer declaration, also the background markup is incomplete. it should be something like this (deduced from your other markup):
div.footer .css {
background: url(images/img20.gif) no-repeat left center;
}
#media .... etc.
Instead of rolling your own, I would suggest looking at an existing library that already is responsive, and then customizing it, so save yourself some time instead of re-inventing the wheel.
Bootstrap is one such excellent library. You can also integrate it easily into Tapestry using the tapestry-bootstrap integration project. I have used this combo on multiple responsive applications, some exclusively for mobiles, and have been quite successful.
I'm working on a project for a friend, which involves making a website for his Real-estate company. The page is all done, with the content on it.. and there's sufficient content that I'd have to scroll down to read the whole page.
When I add the link to the external CSS stylesheet to the header, the page gets the look that I want, but for some reason, the scroll-bars disappear (Chrome and Safari, Mac 10.8) and I can't scroll down to read the content at the bottom. Removing the link to the CSS brings back the scrollbar, but obviously the pages lose all their styling.
I've attached a copy of the stylesheet, if anyone sees something that could cause this, help would be appreciated.
#wrapper {
width: 1024px;
margin: 0 auto;
}
body {
background: #E4BD82 url("../img/bg.gif") repeat;
font: normal 12px/150% "Verdana", "Arial", "Helvetica", sans-serif;
color: #4b2b16;
}
body .text
{
font: normal 12px/150% "Verdana", "Arial", "Helvetica", sans-serif;
}
#header {
margin-left:auto;
margin-right:auto;
top: 0px;
width: 1024px;
height: 150px;
position:relative;
background: url("../img/header.gif") bottom left no-repeat;
}
#menu {
height: 42px;
list-style: none;
position: absolute;
bottom: 5px;
left: 90px;
}
#menu li {
float: left;
height: 42px;
line-height: 42px;
padding: 13px 20px;
color: #D89915;
font: bold 12px "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
}
#menu li a {
padding: 13px 20px;
color: #D89915;
font: bold 12px "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
}
#menu li a:hover {
background-color: #4D3406;
color: #EAF6AD;
}
#sidebar {
position:fixed;
top: 151px; height: 100%; width: 290px;
background: url("../img/sidebar.gif") top left repeat-y;
}
#main {
width: 734px;
margin-left: 300px;
min-height: 1000px;
position: fixed;
}
div, img, form, fieldset, ul, li, h1, h2, h3, h6, p {
margin: 0;
padding: 5;
border: 0;
}
a.photo:link {
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
color: #4b2b16;
}
a.photo:visited {
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
color: #4b2b16;
}
a.photo:hover {
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: underline;
color: #4b2b16;
}
a.photo:active {
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
color: #4b2b16;
}
.copyright {
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
text-align: center;
}
img.display {
margin-left: 150px;
padding: 1px;
border: 5px outset;
border-color: #EE7621;
}
Without seeing the HTML, my first thought was some overflow: hidden but then I noticed this:
#main {
width: 734px;
margin-left: 300px;
min-height: 1000px;
position: fixed;
}
The position: fixed is probably the problem here. Remove it.
Try removing position:fixed; from #main:
#main {
width: 734px;
margin-left: 300px;
min-height: 1000px;
//position: fixed;
}
You need change the property in the #main position, you are using position:fixed, change this to position:scroll. Also do not repeat CSS properties, instead do this:
#wrapper {
width: 1024px;
margin: 0 auto;
}
body {
background: #E4BD82 url("../img/bg.gif") repeat;
font: normal 12px/150% "Verdana", "Arial", "Helvetica", sans-serif;
color: #4b2b16;
}
#header {
margin:0 auto;
top: 0px;
width: 1024px;
height: 150px;
position:relative;
background: url("../img/header.gif") bottom left no-repeat;
}
#menu ul {
height: 42px;
list-style: none;
bottom: 5px;
left: 90px;
}
#menu ul li {
float: left;
height: 42px;
line-height: 42px;
padding: 13px 20px;
font-weight: bold;
}
#menu ul li a {
color: #D89915;
display: block;
text-decoration: none;
}
#menu ul li a:hover {
background-color: #4D3406;
color: #EAF6AD;
}
#sidebar {
position:fixed;
top: 151px; height: 100%; width: 290px;
background: url("../img/sidebar.gif") top left repeat-y;
}
#main {
max-width: 734px;
margin-left: 300px;
position: scroll;
}
div, img, form, fieldset, ul, li, h1, h2, h3, h6, p {
margin: 0;
padding: 5;
border: 0;
}
a.photo, a.photo:visited{
font: normal 8px/100% "Verdana", "Arial", "Helvetica", sans-serif;
text-decoration: none;
color: #4b2b16;
}
a.photo:hover {
text-decoration: underline;
}
.copyright {
text-align: center;
}
img.display {
margin-left: 150px;
padding: 1px;
border: 5px outset;
border-color: #EE7621;
}
I'm trying to get my background image to show at the top center of the page. The image works fine if I do:
<style>
body {
background: #FFF url('img/top_logo_blank_small.png') no-repeat fixed;
}
</style>
I can't seem to work out where I've gone wrong. There must be something I've managed to mess up, I just can't see it. Here is the CSS:
body {
font-family: 'Quattrocento Sans', helvetica, sans-serif;
background: #EEE url('img/top_logo_blank_small.png') no-repeat fixed;
color: #fff;
margin: 0;
padding: 0;
}
a {
color: black;
text-decoration: none;
}
/* Typography */
.header h1 {
position: absolute;
width:100%;
top: 50%;
margin-top: -20px;
text-align: center;
letter-spacing: 4px;
}
.header h1 em {
font-size: 1.200em;
font-style: normal;
}
h1 {
font-size: 2.2em;
color: #fff;
}
.content h2 {
font-size: 1.75em;
color: #fff;
letter-spacing: 4px;
text-align: center;
}
.content h2 em {
font-size: 1.2em;
font-style: normal;
}
.content h3 {
text-align: center;
font-size: 1.0em;
font-weight: normal;
color: #ede0ed;
letter-spacing: 1px;
margin-bottom: 25px;
}
.content h4 {
margin-top: 0;
text-align: center;
font-size: 0.8em;
font-weight: normal;
color: #ede0ed;
letter-spacing: 1px;
}
#banner p {
text-align: center;
}
/* Navigation */
#nav {
margin: 4px 4px 40px;
}
#nav ul {
padding: 0;
margin: auto;
list-style: none;
}
#nav ul li {
width: 50%;
color: #BBB;
float: left;
font-family: 'Cabin Sketch';
font-size: 1.75em;
text-align: center;
background: url(img/scribble_dark.png);
}
#nav ul li a {
display: block;
/*padding: 5px 20px;*/
}
#nav ul li a:hover {
background: #e0d0e0;
}
/* Content */
.container{
max-width: 720px;
margin: 50px auto 0;
background: #FFF url('img/top_logo_blank_small.png') no-repeat fixed 0 0;
}
.header {
position: relative;
background-color: #b88fb8;
border-top: 5px solid #ede0ed;
height: 75px;
}
.content {
background-color: #000;
padding: 15px;
margin-bottom: 10px;
}
div#about {
padding:25px;
min-height: 255px;
}
img#portrait {
float: left;
margin-right: 25px;
width: 256px;
height: 256px;
}
div#footer {
width: 100%;
max-width: 720px;
margin: auto;
color: black;
text-align: right;
padding: 0 10px;
font-size: 0.850em;
}
#media screen and (max-width: 650px) {
.container {
width: 90%;
max-width: none;
}
div#footer {
width: 90%;
}
}
Try to change your path for example:
background: #EEE url('../img/top_logo_blank_small.png') no-repeat fixed top;
Because you are in a subfolder, you have to go up of a level I think
Most likely your css file is in a different folder and therefore needs another path to the image file.
The common way is to put css in a separate css/* folder, so the path should be:
url('../img/top_logo_blank_small.png')
This CSS seems to work fine, are you certain that the image exists?
http://jsfiddle.net/ghsNR/
I've just tried it here and it works fine with an image from http://placehold.it/
body {
font-family: 'Quattrocento Sans', helvetica, sans-serif;
background: #EEE url('http://placehold.it/500x500') no-repeat fixed top;
color: white;
margin: 0px;
padding: 0px;
}
The most likely cause after observing this is that your CSS isn't actually locating your image correctly. I suggest using tools like the Chrome dev tools, or Firebug to inspect the absolute path that the browser is trying to use to load the image and moving forward from there.
Is the css in the same folder as the page? If you have a different folders, you need to change the URL accordingly.
Maybe change the URL to
'../img/top_logo_blank_small.png'