The background on this page isn't displaying and instead just shows the image i have set behind the background. Also I tried centering my table using the methods posted on other threads, but none of them worked for this specifically.
/*
Winter, Edwards, and Boyd style sheet
Filename: styles.css
Author: Justus Self
Date: 4/27/2017
Long giant project
*/
/* reset styles */
html {
font-size: 16px;
}
a, article, audio, body, div, figcaption, figure, footer, header, h1,
h2, h3, img, li, nav, p, section, source, ul, video {
border: 0;
padding: 0;
margin: 0;
}
img, video {
max-width: 100%;
height: auto;
width: auto;
}
ul {
list-style-type: none;
}
/* document-wide styles */
body {
margin: 0 auto;
font-family: Arial, Helvetica, sans-serif;
}
p {
line-height: 1.4em;
font-size: 1.3em;
}
a:link {
color: black;
}
a:visited {
color: #888;
}
/* skip navigation link */
p.skipnavigation a {
position: absolute;
left: -10000px;
}
p.skipnavigation a:focus {
color: ivory;
background-color: #34180f;
top: 0.4em;
left: auto;
right: 0.4em;
z-index: 2;
}
/* header section */
h1 {
text-align: center;
font-family: Bitter, "Times New Roman", Times, serif;
font-weight: 700;
color: ivory;
background-color: white;
font-size: 2.4em;
}
/* site navigation bar */
nav {
color: #34180f;
text-align: center;
background-color: #B8944D;
}
nav li {
margin: 0.3em 0.5em;
display: inline-block;
font-size: 1.3em;
line-height: 1.4em;
}
nav a:link {
text-decoration: none;
color: #744f42;
}
nav a:visited {
color: #744f42;
}
nav a:hover, nav a:focus {
color: ivory;
}
nav ul, nav div, nav iframe {
display: inline-block;
vertical-align: middle;
}
#AboutUs:hover {
color: ivory;
cursor: pointer;
}
#AboutUs {
color: #744f42;
}
/* main content */
article {
margin: 0 auto;
padding: 1.4em;
background: #7eccec;
background: url("images/bg.jpg");
}
article div {
max-width: 854px;
margin: 0 auto;
padding: 0 3% 1em;
background-color: ivory;
overflow: auto;
}
article div.welcome {
padding-top: 2em;
}
article div figure {
float: left;
padding-right: 2%;
padding-bottom: 2%
margin-top: 20px;
}
.container {
min-width: 600px;
max-width: 800px;
margin: 0 auto;
padding: 0 3% 0;
background-color: darkblue;
overflow: auto;
}
h2 {
padding: 0.4em;
text-align: left;
font-family: Bitter, "Times New Roman", Times, serif;
font-size: 2em;
font-weight: 700;
}
h3 {
margin: 1.4em 0 0;
font-size: 1.6em;
font-family: Bitter, "Times New Roman", Times, serif;
font-weight: 700;
clear: both;
}
h3 iframe.iframes{
border: none;
}
section p {
margin: 1em 0;
}
article figure {
max-width: 100%;
margin-left: 2em;
float: right;
}
article figcaption {
text-align: center;
}
.Bookkeeping {
clear: right;
float: left;
width: 60%;
}
.Testimonial1 {
border: 2px solid black;
background-color: white;
border-radius: 5px;
padding: 16px;
margin: 16px 0;
position: relative;
top: 6em;
}
.Testimonial{
border: 2px solid black;
background-color: white;
border-radius: 5px;
padding: 16px;
margin: 16px 0;
position: relative;
top: 6em;
}
.History {
clear: left;
float: right;
width: 47%;
}
.Olddude {
border-radius: 5px;
border: 1em solid #B8944D;
margin: 1em;
position: relative;
top: 10em;
}
.nonprofit1 {
width: 60%;
clear: left;
float: right;
}
.nonprofit {
margin: 1em;
float: left;
position: relative;
}
/* form styles */
form {
padding: 10px;
}
/* fieldsset styles */
fieldset {
margin-bottom: 0.8em;
}
fieldset fieldset {
margin-top: 1em;
padding: 0.8em;
border: 1px solid #777;
}
/* field styles */
.contactinfo input, #stay-nights, textarea {
border: 1px solid #ccc;
padding: 0.2em;
font-size: 1em;
}
select {
margin-bottom: 0.6em;
}
.contactinfo input {
position: absolute;
left: 5em;
}
.schedule input {
position: absolute;
left: 10em;
}
#nameinput, #emailinput {
width: 25em;
}
#phoneinput {
width: 12em;
}
#stay-nights {
width: 3em;
}
#submit {
border: none;
padding: 0.4em 0.6em;
background-color: #e3d5ba;
font-size: 1.25em;
border-radius: 10px;
}
/* main content table */
th, td {
border: 1px solid black;
padding: 0.5em;
}
th {
background-color: lightblue;
}
.email {
background-color: ivory;
}
.name {
background-color: pink;
}
.degree {
background-color: orange;
}
/* Main Content CSS Table */
.table {
margin: 1em 0;
font-size: 1.3em;
display: table;
}
.row {
display: table-row;
}
.row div {
padding: 0.25em 0.5em;
display: table-cell;
}
.day {
font-weight: bold;
}
/* label styles */
label {
font-size: 1em;
line-height: 1.6em;
}
.contactinfo label {
display: block;
position: relative;
margin: 0.8em 0;
}
.services label, .method label {
margin-right: 1.6em;
}
.schedule p{
width: 9.2em;
float: left;
}
.date-picker label {
position: absolute;
left: -10000px;
}
/* footer section */
footer {
padding: 0.6em;
background-color: darkblue;
color: ivory;
text-align: center;
}
.copyright {
text-align: center;
font-size: .8em;
color: white;
}
/* print styles */
#media print {
body, h1, article, footer {
color: rgb(0,0,0);
background: rgb(255,255,255);
}
body {
max-width: 100%;
}
nav {
display: none;
}
}
#page {
margin: 0.75in;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>WEB Managing Partners</title>
<!--
Winter, Edwards, and Boyd (WEB) main web page
Filename: index.html
Author: Justus Self
Date: 5/2/2017
A Giant Project that makes me really sad
-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="modernizr.custom.40753.js"></script>
<link href='http://fonts.googleapis.com/css?family=Bitter:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="styles.css">
<link rel="shortcut icon" href="images/favicon.ico">
</head>
<body>
<div class="container">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<p class="skipnavigation">Skip navigation</p>
<header>
<h1><img src="images/W.E.B.png" width="501" height="299" alt="Winter, Edwards, & Boyd"></h1>
</header>
<nav class="sitenavigation">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Contact</li>
</ul>
<ul>
<li>Managing Partners</li>
<li>Company History</li>
<li>Community Involvement</li>
</ul>
<div class="fb-like" data-href="https://facebook.com/cengagebrain"
data-layout="button" data-action="like" data-size="small" data-show-faces="true"
data-share="false">
</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
Tweet<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</nav>
<article id="contentstart">
<h2>Managing Partners</h2>
<h3>Our employees may be contacted using the e-mails shown below</h3>
<br>
<table>
<colgroup>
<col class="name">
<col class="email">
<col class="degree">
</colgroup>
<thead>
<tr>
<th>Employee Name</th>
<th>E-mail</th>
<th>Degree</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mike Edwards</td>
<td>medwards#webcpa.com</td>
<td>Certified Public Accountant</td>
</tr>
<tr>
<td>Julia Winters</td>
<td>jwinter#webcpa.com</td>
<td>Certified Financial Planner</td>
<tr>
<td>Regina Boyd</td>
<td>rboyd#webcpa.com</td>
<td> Certified Public Accountant </td>
</tr>
</tbody>
</table>
<br>
<br>
<footer>
<nav class="sitenavigation">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Contact</li>
</ul>
</nav>
<p class="copyright">ⒸJustus Self</p>
<p class="copyright"> CIS 130 – SP16</p>
</footer>
</article>
</div>
</body>
</html>
background property needs height and (max-)width just use the values you want and you are good to go.
/*
Winter, Edwards, and Boyd style sheet
Filename: styles.css
Author: Justus Self
Date: 4/27/2017
Long giant project
*/
/* reset styles */
html {
font-size: 16px;
}
a,
article,
audio,
body,
div,
figcaption,
figure,
footer,
header,
h1,
h2,
h3,
img,
li,
nav,
p,
section,
source,
ul,
video {
border: 0;
padding: 0;
margin: 0;
}
img,
video {
max-width: 100%;
height: auto;
width: auto;
}
ul {
list-style-type: none;
}
/* document-wide styles */
body {
margin: 0 auto;
font-family: Arial, Helvetica, sans-serif;
}
p {
line-height: 1.4em;
font-size: 1.3em;
}
a:link {
color: black;
}
a:visited {
color: #888;
}
/* skip navigation link */
p.skipnavigation a {
position: absolute;
left: -10000px;
}
p.skipnavigation a:focus {
color: ivory;
background-color: #34180f;
top: 0.4em;
left: auto;
right: 0.4em;
z-index: 2;
}
/* header section */
h1 {
text-align: center;
font-family: Bitter, "Times New Roman", Times, serif;
font-weight: 700;
color: ivory;
background-color: white;
font-size: 2.4em;
}
/* TABLE CENTER*/
table { margin:auto}
/* site navigation bar */
nav {
color: #34180f;
text-align: center;
background-color: #B8944D;
}
nav li {
margin: 0.3em 0.5em;
display: inline-block;
font-size: 1.3em;
line-height: 1.4em;
}
nav a:link {
text-decoration: none;
color: #744f42;
}
nav a:visited {
color: #744f42;
}
nav a:hover,
nav a:focus {
color: ivory;
}
nav ul,
nav div,
nav iframe {
display: inline-block;
vertical-align: middle;
}
#AboutUs:hover {
color: ivory;
cursor: pointer;
}
#AboutUs {
color: #744f42;
}
/* main content */
article {
margin: 0 auto;
padding: 1.4em;
}
article div {
max-width: 854px;
margin: 0 auto;
padding: 0 3% 1em;
background-color: ivory;
overflow: auto;
}
article div.welcome {
padding-top: 2em;
}
article div figure {
float: left;
padding-right: 2%;
padding-bottom: 2% margin-top: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 0 3% 0;
background: url("http://lorempixel.com/1600/900") no-repeat 0 0 / cover;
height: 100vh;
max-width: 100%;
overflow: auto;
}
h2 {
padding: 0.4em;
text-align: left;
font-family: Bitter, "Times New Roman", Times, serif;
font-size: 2em;
font-weight: 700;
}
h3 {
margin: 1.4em 0 0;
font-size: 1.6em;
font-family: Bitter, "Times New Roman", Times, serif;
font-weight: 700;
clear: both;
}
h3 iframe.iframes {
border: none;
}
section p {
margin: 1em 0;
}
article figure {
max-width: 100%;
margin-left: 2em;
float: right;
}
article figcaption {
text-align: center;
}
.Bookkeeping {
clear: right;
float: left;
width: 60%;
}
.Testimonial1 {
border: 2px solid black;
background-color: white;
border-radius: 5px;
padding: 16px;
margin: 16px 0;
position: relative;
top: 6em;
}
.Testimonial {
border: 2px solid black;
background-color: white;
border-radius: 5px;
padding: 16px;
margin: 16px 0;
position: relative;
top: 6em;
}
.History {
clear: left;
float: right;
width: 47%;
}
.Olddude {
border-radius: 5px;
border: 1em solid #B8944D;
margin: 1em;
position: relative;
top: 10em;
}
.nonprofit1 {
width: 60%;
clear: left;
float: right;
}
.nonprofit {
margin: 1em;
float: left;
position: relative;
}
/* form styles */
form {
padding: 10px;
}
/* fieldsset styles */
fieldset {
margin-bottom: 0.8em;
}
fieldset fieldset {
margin-top: 1em;
padding: 0.8em;
border: 1px solid #777;
}
/* field styles */
.contactinfo input,
#stay-nights,
textarea {
border: 1px solid #ccc;
padding: 0.2em;
font-size: 1em;
}
select {
margin-bottom: 0.6em;
}
.contactinfo input {
position: absolute;
left: 5em;
}
.schedule input {
position: absolute;
left: 10em;
}
#nameinput,
#emailinput {
width: 25em;
}
#phoneinput {
width: 12em;
}
#stay-nights {
width: 3em;
}
#submit {
border: none;
padding: 0.4em 0.6em;
background-color: #e3d5ba;
font-size: 1.25em;
border-radius: 10px;
}
/* main content table */
th,
td {
border: 1px solid black;
padding: 0.5em;
}
th {
background-color: lightblue;
}
.email {
background-color: ivory;
}
.name {
background-color: pink;
}
.degree {
background-color: orange;
}
/* Main Content CSS Table */
.table {
margin: 1em auto;
font-size: 1.3em;
display: table;
}
.row {
display: table-row;
}
.row div {
padding: 0.25em 0.5em;
display: table-cell;
}
.day {
font-weight: bold;
}
/* label styles */
label {
font-size: 1em;
line-height: 1.6em;
}
.contactinfo label {
display: block;
position: relative;
margin: 0.8em 0;
}
.services label,
.method label {
margin-right: 1.6em;
}
.schedule p {
width: 9.2em;
float: left;
}
.date-picker label {
position: absolute;
left: -10000px;
}
/* footer section */
footer {
padding: 0.6em;
background-color: darkblue;
color: ivory;
text-align: center;
}
.copyright {
text-align: center;
font-size: .8em;
color: white;
}
/* print styles */
#media print {
body,
h1,
article,
footer {
color: rgb(0, 0, 0);
background: rgb(255, 255, 255);
}
body {
max-width: 100%;
}
nav {
display: none;
}
}
#page {
margin: 0.75in;
}
<body>
<div class="container">
<p class="skipnavigation">Skip navigation</p>
<header>
<h1>
<img src="images/W.E.B.png" width="501" height="299" alt="Winter, Edwards, & Boyd">
</h1>
</header>
<nav class="sitenavigation">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Contact</li>
</ul>
<ul>
<li>Managing Partners</li>
<li>Company History</li>
<li>Community Involvement</li>
</ul>
</nav>
<article id="contentstart">
<h2>Managing Partners</h2>
<h3>Our employees may be contacted using the e-mails shown below</h3>
<br>
<table>
<colgroup>
<col class="name">
<col class="email">
<col class="degree">
</colgroup>
<thead>
<tr>
<th>Employee Name</th>
<th>E-mail</th>
<th>Degree</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mike Edwards</td>
<td>medwards#webcpa.com</td>
<td>Certified Public Accountant</td>
</tr>
<tr>
<td>Julia Winters</td>
<td>jwinter#webcpa.com</td>
<td>Certified Financial Planner</td>
<tr>
<td>Regina Boyd</td>
<td>rboyd#webcpa.com</td>
<td> Certified Public Accountant </td>
</tr>
</tbody>
</table>
<br>
<br>
<footer>
<nav class="sitenavigation">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Contact</li>
</ul>
</nav>
<p class="copyright">ⒸJustus Self</p>
<p class="copyright"> CIS 130 – SP16</p>
</footer>
</article>
</div>
Related
I'm doing an assignment in my class with HTML and CSS. I'm having trouble getting the navigation for phone and tablet views to look like the attached image. I'm assuming this could be resolved toward the bottom of the CSS code? Also, my page looks very wide compared to the photos in all views. I'm very much a novice at this if it isn't obvious.
body {
background-color: #b8dbed;
font-family: Arial;
}
header {
background-color: #000033;
color: #ffffff;
margin-left: auto;
margin-right: auto;
height: 120px;
padding-top: 30px;
padding-left: 3em;
text-align: center;
}
nav {
font-weight: bold;
padding: 1.5em;
font-size: 120%;
float: left;
width: 160px;
}
nav a {
text-decoration: none;
}
h1 {
margin-bottom: 0;
font-family: Georgia;
margin-top: 0;
font-size: 3em;
letter-spacing: 0.25em;
}
h2 {
color: #3399cc;
font-family: Georgia;
text-shadow: 1px 1px 1px #cccccc;
}
h3 {
font-family: Georgia;
color: #000033;
}
dt {
color: #000033;
}
.resort {
color: #5c7fa3;
font-weight: bold;
}
nav ul {
margin: 0;
padding-left: 0;
font-size: 1.2em;
}
main ul {
list-style-image: url(marker.gif);
}
footer {
font-size: 75%;
font-style: italic;
text-align: center;
font-family: Georgia;
padding: 20px;
margin-left: 190px;
background: #ffffff;
}
#contact {
font-size: 90%;
}
#wrapper {
width: 80%;
margin-left: auto;
margin-right: auto;
max-width: 960px;
min-width: 2048px;
background: #90c7e3;
box-shadow: 3px 3px 3px #333333;
border: 1px solid #000033;
background-image: linear-gradient(to bottom, #ffffff, #90c7e3);
}
main {
padding-top: 1px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
display: block;
background: #ffffff;
margin-left: 190px;
padding-left: 30px;
}
#homehero {
height: 300px;
background-image: url(coast2.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#trailhero {
height: 300px;
background-image: url(trail.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#yurthero {
height: 300px;
background-image: url(yurt.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
* {
box-sizing: border-box;
}
a:link {
color: #5c7fa3;
}
a:visited {
color: #344873;
}
a:hover {
color: #a52a2a;
}
header,
main,
nav,
footer,
figure,
figcaption,
aside,
section,
article {
display: block;
}
#mobile {
display: none;
}
#desktop {
display: inline;
}
#media only screen and (max-width: 64em) {
body {
background: #ffffff;
}
#wrapper {
min-width: 0;
width: auto;
box-shadow: none;
border: none;
}
header {
padding-top: 0.5em;
padding-bottom: 0.5em;
padding-left: 0;
height: auto;
}
h1 {
letter-spacing: 0.1em;
}
main {
margin-left: 0;
}
nav {
float: none;
width: auto;
text-align: center;
padding: 0.5em;
}
nav li {
display: inline;
padding-top: 0.25em;
padding-bottom: 0.25em;
padding-left: 0.75em;
padding-right: 0.75em;
}
#homehero {
margin-left: 0;
height: 200px;
}
#yurthero {
margin-left: 0;
height: 200px;
}
#trailhero {
margin-left: 0;
height: 200px;
}
footer {
margin-left: 0;
}
}
#media only screen and (max-width: 37.5em) {
main {
padding-top: 0.1em;
padding-bottom: 0.1em;
padding-right: 1em;
padding-left: 1em;
font-size: 90%;
}
h1 {
font-size: 2em;
}
nav {
padding: 0;
}
nav li {
display: block;
margin: 0;
border-bottom: 2px solid #330000;
}
nav a {
display: block;
}
#homehero {
background-image: none;
height: 0;
}
#yurthero {
background-image: none;
height: 0;
}
#trailhero {
background-image: none;
height: 0;
}
#mobile {
display: inline;
}
#desktop {
display: none;
}
}
<h1> Pacific Trails Resort </h1>
</header>
<nav>
<ul>
Home Yurts Activities Reservations
</ul>
</nav>
<div id="homehero">
</div>
<main>
<h2>Enjoy Nature in Luxury</h2>
<p> <span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast with panoramic views of the Pacific Ocean. Your stay at Pacific Trails Resort includes a sumptuously appointed private yurt and a cooked-to-order
breakfast each morning.</p>
<ul>
<li>Unwind in the heated outdoor pool and whirlpool</li>
<li>Explore the coast on your own or join our guided tours</li>
<li>Relax in our lodge while enjoying complimentary appetizers and beverages</li>
<li>Savor nightly fine dining with an ocean view</li>
</ul>
<br>
<div id="contact">
<span class="resort">Pacific Trails Resort</span> <br> 12010 Pacific Trails Road <br> Zephyr, CA 95555 <br>
<br>
<a id="mobile" href="tel:888-555-5555">888-555-5555</a> <br>
<span id="desktop">888-555-5555</span>
<br>
</div>
</main>
<footer>
Copyright © 2018 Pacific Trails Resort<br>
e.sween12#gmail.com
</footer>
</div>
Any help or guidance would be appreciated.
You were almost there. I found a few typos in your HTML code like the <header> not having an opening tag, along with semantic issues such as not using <li> elements in your unordered lists. After updating the HTML, all that was left was to provide a background color for the containers which hold the nav menu items at mobile and tablet viewport widths (ie the two media queries). I added a stock photo to the background-image for demonstration.
Lastly, updating your media queries to use px values instead of em. As #DCR mentioned, the em base value may change which in turn would cause your media queries to take affect at varying widths determined by the base value. Everything seems to match the desired output in the images you've included.
If you would like the page content to not exceed a certain viewport width, just specify max-width on the <body> and center it on the page with margin: 0 auto which creates 0 top/bottom margin and "auto" sized left/right margins to center the content. I also added a border and box-shadow to the body at "desktop size" so it matches your desired output.
body {
background-color: #b8dbed;
font-family: Arial;
max-width: 100ch; /* vary this */
margin: 0 auto 1rem auto;
border: .1rem solid #333;
box-shadow: 1px 2px 2px 0px #222;
}
header {
background-color: #000033;
color: #ffffff;
margin-left: auto;
margin-right: auto;
height: 120px;
padding-top: 30px;
padding-left: 3em;
text-align: center;
}
nav {
font-weight: bold;
padding: 1.5em;
font-size: 120%;
float: left;
width: 160px;
}
nav a {
text-decoration: none;
}
nav ul {
list-style-type: none;
}
h1 {
margin-bottom: 0;
font-family: Georgia;
margin-top: 0;
font-size: 3em;
letter-spacing: 0.25em;
}
h2 {
color: #3399cc;
font-family: Georgia;
text-shadow: 1px 1px 1px #cccccc;
}
h3 {
font-family: Georgia;
color: #000033;
}
dt {
color: #000033;
}
.resort {
color: #5c7fa3;
font-weight: bold;
}
nav ul {
margin: 0;
padding-left: 0;
font-size: 1.2em;
}
main ul {
list-style-image: url(marker.gif);
}
footer {
font-size: 75%;
font-style: italic;
text-align: center;
font-family: Georgia;
padding: 20px;
margin-left: 190px;
background: #ffffff;
}
#contact {
font-size: 90%;
}
#wrapper {
width: 80%;
margin-left: auto;
margin-right: auto;
max-width: 960px;
min-width: 2048px;
background: #90c7e3;
box-shadow: 3px 3px 3px #333333;
border: 1px solid #000033;
background-image: linear-gradient(to bottom, #ffffff, #90c7e3);
}
main {
padding-top: 1px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
display: block;
background: #ffffff;
margin-left: 190px;
padding-left: 30px;
}
#homehero {
height: 300px;
background-image: url(https://www.visitcalifornia.com/sites/visitcalifornia.com/files/NC_DuncansCove_Seeff_1280x642_sized_downsized.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#trailhero {
height: 300px;
background-image: url(trail.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
#yurthero {
height: 300px;
background-image: url(yurt.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-left: 190px;
}
* {
box-sizing: border-box;
}
a:link {
color: #5c7fa3;
}
a:visited {
color: #344873;
}
a:hover {
color: #a52a2a;
}
header,
main,
nav,
footer,
figure,
figcaption,
aside,
section,
article {
display: block;
}
#mobile {
display: none;
}
#desktop {
display: inline;
}
#media only screen and (max-width: 1024px) {
body {
background: #ffffff;
max-width: none;
border: none;
box-shadow: none;
}
#wrapper {
min-width: 0;
width: auto;
box-shadow: none;
border: none;
}
header {
padding-top: 0.5em;
padding-bottom: 0.5em;
padding-left: 0;
height: auto;
}
h1 {
letter-spacing: 0.1em;
}
main {
margin-left: 0;
}
nav {
float: none;
width: auto;
text-align: center;
padding: 0.5em;
background: rgba(213, 244, 250, .4);
}
nav li {
display: inline;
padding-top: 0.25em;
padding-bottom: 0.25em;
padding-left: 0.75em;
padding-right: 0.75em;
}
#homehero {
margin-left: 0;
height: 200px;
}
#yurthero {
margin-left: 0;
height: 200px;
}
#trailhero {
margin-left: 0;
height: 200px;
}
footer {
margin-left: 0;
}
}
#media only screen and (max-width: 600px) {
body {
box-shadow: none;
border: none;
}
main {
padding-top: 0.1em;
padding-bottom: 0.1em;
padding-right: 1em;
padding-left: 1em;
font-size: 90%;
}
h1 {
font-size: 2em;
}
nav {
padding: 0;
background: rgba(213, 244, 250, .4);
}
nav li {
display: block;
margin: 0;
border-bottom: 2px solid #330000;
}
nav a {
display: block;
}
#homehero {
background-image: none;
height: 0;
}
#yurthero {
background-image: none;
height: 0;
}
#trailhero {
background-image: none;
height: 0;
}
#mobile {
display: inline;
}
#desktop {
display: none;
}
}
<header>
<h1> Pacific Trails Resort </h1>
</header>
<nav>
<ul>
<li>Home
<li>Yurts</li>
<li>Activities</li>
<li>Reservations</li>
</ul>
</nav>
<div id="homehero">
</div>
<main>
<h2>Enjoy Nature in Luxury</h2>
<p> <span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast with panoramic views of the Pacific Ocean. Your stay at Pacific Trails Resort includes a sumptuously appointed private yurt and a cooked-to-order
breakfast each morning.</p>
<ul>
<li>Unwind in the heated outdoor pool and whirlpool</li>
<li>Explore the coast on your own or join our guided tours</li>
<li>Relax in our lodge while enjoying complimentary appetizers and beverages</li>
<li>Savor nightly fine dining with an ocean view</li>
</ul>
<br>
<div id="contact">
<span class="resort">Pacific Trails Resort</span> <br> 12010 Pacific Trails Road <br> Zephyr, CA 95555 <br>
<br>
<a id="mobile" href="tel:888-555-5555">888-555-5555</a> <br>
<span id="desktop">888-555-5555</span>
<br>
</div>
</main>
<footer>
Copyright © 2018 Pacific Trails Resort<br>
e.sween12#gmail.com
</footer>
</div>
So initially the top half of my black menu blocks appeared over the top of the banner, but now the top half of them are cut off underneath of the banner like this:
Here is my styles.css file:
/* Base */
* {
margin: 0;
padding: 0;
}
body {
/*background-color: #F5F4F1;*/
background-image: url('./img/bg.jpg');
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 15px;
line-height: 20px;
color: #353535;
-webkit-font-smoothing: antialiased;
text-rendering: optimizelegibility;
}
#banner {
position: relative;
}
#banner__text-content {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 100%;
text-align: center;
}
#banner__title {
font-size: 5.8rem;
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
}
h1,h2,h3,h4,h5,h6 {
margin: 30px 0;
/*font-weight: 200;*/
color: #8ca757;
}
h1 {
font-size: 35px;
}
h1 small {
font-size: 25px;
color: #666;
}
h2 + p {
margin-top: -20px;
}
h3 + p {
margin-top: -20px;
}
h2,h3,h4 {
font-size: 30px;
}
h4.error {
color: #faa722;
}
h5,h6 {
font-size: 20px;
}
p {
margin: 0 0 20px;
}
a:link, a:visited {
color: #8ca757;
}
a:hover {
color: #7a9347;
}
ul, ol {
margin: 0 0 10px 18px;
}
ul li, ol li {
margin: 0 0 15px;
}
hr {
border: none;
height: 18px;
width: 114px;
background-image: url('./img/hr.png') center center no-repeat;
margin: 20px auto;
}
small {
font-size: 12px;
}
blockquote {
background: white;
padding: 10px;
margin: 0 0 15px;
border-left: solid 4px #d1cbb8;
font-style: italic;
}
blockquote p {
margin: 5px 0 10px;
}
blockquote code {
font-style: normal;
}
code {
color: #006699;
font-weight: bold;
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
}
sup {
font-size: 0.6em;
}
/* Layout */
.wrapper {
position: relative;
width: 620px;
margin: 40px auto;
padding: 40px;
background: white;
text-align: center;
}
.wrapper:before, .wrapper:after {
content: "";
position: absolute;
top: 5px;
left: -5px;
width: 100%;
height: 100%;
background: #97917e;
z-index: -1;
}
.wrapper:before {
top: 10px;
left: -10px;
background: #514933;
}
#logo {
width: 240px;
margin: 0 auto;
display: block;
}
.sandbox {
padding: 20px;
background: #f8f5f1;
text-align: left;
}
aside {
background: white;
border: dashed 2px #97917e;
padding: 10px 20px;
margin: 40px;
}
aside h3 {
font-size: 24px;
margin-top: 10px;
}
aside h6 {
margin: 15px 0 5px;
}
table {
width: 100%;
font-size: 13px;
background: white;
margin: 0 0 20px;
}
table td {
border-bottom: solid 1px #d1cbb8;
padding: 4px;
}
table th {
background: #8ca757;
color: white;
padding: 4px;
font-weight: normal;
font-size: 15px;
}
/* Global */
input {
-webkit-font-smoothing: antialiased;
text-rendering: optimizelegibility;
}
autton, input.button {
display: inline-block;
background: #ccc;
outline: solid 2px #ccc;
border: solid 2px white;
color: white;
padding: 10px 15px;
margin: 20px 0;
text-decoration: none;
font-family: inherit;
font-size: inherit;
font-weight: bold;
cursor: pointer;
}
.button:hover, input.button:hover {
background: #bbb;
outline-color: #bbb;
}
.button.prev {
float: left;
background: #514933;
outline-color: #514933;
}
.button.prev:hover {
background: #494331;
outline-color: #494331;
}
.button.next, input.button.next {
background: #8ca757;
outline: solid 2px #8ca757;
float: right;
}
.button.next:hover, input.button.next:hover {
background: #7c9745;
}
input.button.next {
display: block;
float: none;
width: 100%;
}
.block {
display: block;
}
.cf:before,
.cf:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.cf:after {
clear: both;
}
/**
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.cf {
*zoom: 1;
}
.copyright-info h4, .copyright-info h5 {
margin: 0;
line-height: 18px;
font-size: 14px;
text-align: center;
}
.copyright-info h4 {
font-weight: bold;
}
.copyright-info {
margin: 20px 0 40px;
}
/* Final example website */
#final-example .wrapper {
width: 800px;
padding: 0;
}
#final-example .content {
padding: 20px 50px 50px;
text-align: left;
}
#final-example #nav {
margin: -27px 0 0;
}
#final-example #nav ul {
display: inline-block;
list-style: none;
text-align: left;
}
#final-example #nav ul li {
display: inline-block;
text-align: center;
margin: 0 10px;
}
#final-example #nav ul li a {
display: block;
background: #353535;
outline: solid 2px #353535;
border: solid 2px white;
color: white;
padding: 10px 15px;
text-decoration: none;
}
#final-example #nav ul li a:hover {
background: #8ca757;
outline: solid 2px #8ca757;
}
#final-example #philosophy {
text-align: center;
font-size: 18px;
line-height: 22px;
}
#final-example #footer {
font-size: 12px;
line-height: 15px;
margin: 60px 0 0 0;
}
#final-example #footer strong {
display: block;
margin: 0 0 20px;
}
#final-example .column {
display: block;
float: left;
}
#final-example .column.three {
width: 203px;
margin-right: 45px;
}
#final-example .column.last {
margin: 0;
}
#final-example small {
display: block;
text-align: center;
margin: 40px 0 0;
}
#final-example .member {
width: 203px;
float: left;
margin-right: 45px;
}
#final-example .member:last-child {
margin: 0;
}
#final-example .member img {
max-width: 100%;
}
#final-example .closed {
color: #d13916;
}
#final-example .open {
color: #67b512;
}
#menu-items ul {
list-style: none;
margin: 0;
padding: 20px 0;
text-align: center;
font-size: 18px;
}
#menu-items ul li a {
text-decoration: none;
font-weight: bold;
}
.price {
float: right;
font-size: 18px;
font-weight: bold;
color: #353535;
}
#contact {
width: 320px;
margin: 0 auto;
}
#contact-form label {
display: block;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form textarea {
border: solid 2px #353535;
outline: none;
font-size: 18px;
padding: 10px;
margin: 0 0 10px;
width: 300px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
text-rendering: optimizelegibility;
}
#contact-form textarea {
resize: vertical;
height: 120px;
}
#contact-form input[type="checkbox"] + label {
display: inline;
cursor: pointer;
}
When I try to do this:
#final-example #nav {
margin: -27px 0 0;
position: absolute;
}
to this
#final-example #nav {
margin: -27px 0 0;
}
this happens:
and text-align:center; did not work. Any ideas?
Here is the index.php:
<!DOCTYPE html>
<html>
<head>
<title>MicroUrb</title>
<link rel="stylesheet" href="assets/styles.css">
</head>
<body id="final-example">
<div class="wrapper">
<div id="banner">
<a href="/" title="Return to Home">
<img src="assets/img/banner0.jpg" alt="MicroUrb">
<div id="banner__text-content">
<h1 id="banner__title">MicroUrb</h1>
</div>
</a>
</div><!-- banner -->
<div id="nav">
<ul>
<li>Home</li>
<li>Team</li>
<li>Products</li>
<li>Contact</li>
</ul>
</div><!-- nav -->
<div class="content">
<div id="footer" class="cf">
<div class="column three">
<strong>Phone</strong>
609.505.3395
</div><!-- column -->
<div class="column three">
<strong>Location</strong>
<!-- location to go here -->
</div><!-- column -->
<div class="column three last">
<strong>Hours</strong>
<em>Tuesday - Thursday</em><br>
1:00pm - 9:00pm<br><br>
<em>Friday and Saturday</em><br>
4:00pm - 11:00pm<br><br>
<em>Sunday - Monday</em>
Closed<br><br>
</div><!-- column -->
</div><!-- footer -->
<small>©2017 MicroUrb</small>
</div><!-- content -->
</div><!-- wrapper -->
<div class="copyright-info">
<?php includes('../assets/includes/copyright.php'); ?>
</div><!-- copyright-info -->
</body>
</html>
Put a z-index on the nav and set the position to relative
#final-example #nav {
margin: -27px 0 0;
z-index: 5;
position: relative;
}
I believe to get the navigation in front of the banner like you are trying to achieve you could utilise the z-index property.
Add a z-index of 1 to your #final-example #nav {} and a z-index of 0 to your #banner {} which will bring the navigation in front of the banner while keeping its absolute positioning in the centre.
The final outcome will be:
#final-example #nav {
margin: -27px 0 0;
position: absolute;
z-index: 1;
}
#banner {
position: relative;
z-index: 0;
}
Let me know if you need any other help.
You can use z-index on the nav element to make it appear above the banner if you set the banner to a lower z-index compared to the nav element.
So for example:
#final-example #nav {
z-index:1;
position:relative;
margin:-27px auto 0;
}
That said, it would be useful if you would've posted your html part as well.
Edit:
Further investigation and with a temporary asset, the code seems to work fine with the code posted above as can be seen in this JSFiddle: https://jsfiddle.net/t2d70q3y/2/
Let me know if you require further assistance.
I need to fix my BreadCrumb in my simple website, it shows the whole list not just the one is opened with the pages before. Like, it should show HOME, HOME>About Us, HOME>Gallery, HOME>Contact US. But just show the whole breadcrumb list the whole time.
Can you help me? thanks
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div>
<img style="width: 370px;" src="pictures/logo.png" />
</div>
<div>
<ul class="breadcrumb">
<li>Home</li>
<li>About Us</li>
<li>Our Menu</li>
<li>Gallery</li>
<li>Contact Us</li>
</ul>
</div>
<div>
<nav id="mainMenu">
<ul class="menu">
<li>Home</li>
<li>About Us</li>
<li>Our Menu</li>
<li>Gallery</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
<div style="width: 100%;" id="slider">
<br /> <br />
<figure />
<img src="pictures/image1.png" alt> <img
src="pictures/image2.png" alt> <img src="pictures/image3.jpg"
alt> <img src="pictures/image4.jpg" alt> <img
src="pictures/image5.jpg" alt> <br /> <br />
</div>
<div style="background-color: #b30000; height: 250px; width: 500% px">
<br />
<p>
<h1>
KFC<br> 299 Westmoreland St.<br> Dublin 2<br> Eircode:
D02 HK35<br> Ireland
</h1>
</p>
<br />
<h1>
<p>
Tel + 353 1 9999999<br> Fax + 353 1 6666666<br> Email
KFC#.ie
</p>
</h1>
</div>
</body>
</html>
CSS
font-size: 19px;
font-family: Calibri, arial, helvetica;
color: white;
padding: 0cm 0cm 0cm 1cm;
line-height: 1.3;
letter-spacing:1px;
}
h2 {
font-size: 30px;
font-family: Calibri, arial, helvetica, sans-serif;
color: Brack;
padding: 0cm 0cm 0cm 1cm;
line-height: 1.3;
text-align:center;
}
h3 {
font-size: 15px;
font-family: Calibri, arial, helvetica, sans-serif;
color: Brack;
padding: 0cm 0cm 0cm 11.5cm;
line-height: 1.3;
}
h4 {
font-size: 30px;
font-family: Calibri, arial, helvetica, sans-serif;
color: Brack;
padding: 0cm 0cm 0cm 4cm;
line-height: 1.3;
text-align:left;
float:left;
}
h5 {
font-size: 30px;
font-family: Calibri, arial, helvetica, sans-serif;
color: Brack;
padding-right: 6.5cm;
line-height: 1.3;
text-align:right;
}
*{margin:0; padding:0;}
.menu {
list-style:none;
border:1px solid #c0c0c0;
float:left;
text-align:center;
font-family: Calibri, arial, helvetica, sans-serif;
font-size: 20px
}
.menu li{
position:relative;
float:auto;
border-right:1px solid #c0c0c0;
}
.menu li a{color:#333; text-decoration:none; padding:5px 20px; display:block;}
.menu li a:hover{
background:#b30000;
color:#fff;
-moz-box-shadow:0 3px 10px 0 #CCC;
-webkit-box-shadow:0 3px 10px 0 #ccc;
text-shadow:0px 0px 5px #fff;
}
.menu li ul li{
border:1px solid #c0c0c0;
display:block;
width:150px;
}
#mainMenu {
width:1000px;
margin:0 auto;
list-style:none;
}
#mainMenu li {
float:left;
}
#mainMenu a {
display:block;
text-align:center;
width:150px; /
text-decoration:none;
}
#keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}
body { margin: 0; }
div#slider { overflow: hidden; }
div#slider figure img { width: 20%; float: left; }
div#slider figure {
position: relative;
width: 500%;
margin: 0;
left: 0;
text-align: middle;
font-size: 0;
animation: 30s slidy infinite;
}
div.vertical-line{
width: 1px;
background-color: silver;
height: 100%;
float: left;
border: 2px ridge silver ;
border-radius: 10px;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical
}
input[type=submit] {
background-color: #b30000;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #b30000;
}
.container {
border-radius: 5px;
background-color: #808080;
padding: 20px;
width: 45%;
float: left;
font-size: 16px;
font-weight: 900;
font-family: Calibri, arial, helvetica, sans-serif;
letter-spacing:0.5px;
}
body {
background: white;
margin: 0;
font-family: monospace;
}
.gallery {
width: 90%;
margin: auto;
list-style: none;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.gallery li {
margin: 5px;
}
.gallery img {
width: 200px;
height: 200px;
}
.modal {
display: none;
}
.modal:target {
display: block;
position: fixed;
background: rgba(0,0,0,0.8);
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.modal h3 {
color: #fff;
font-size: 30px;
text-align: center;
margin: 15px 0;
}
.imagen {
width: 100%;
height: 80%;
display: flex;
justify-content: center;
align-items: center;
}
.imagen a {
color: #fff;
font-size: 40px;
text-decoration: none;
margin: 0 10px;
}
.imagen a:nth-child(2) {
margin: 0;
height: 100%;
flex-shrink: 2;
}
.imagen img {
width: 500px;
height: 100%;
max-width: 100%;
border: 7px solid #fff;
box-sizing: border-box;
}
.cerrar {
display: block;
background: #fff;
width: 25px;
height: 25px;
margin: 15px auto;
text-align: center;
text-decoration: none;
font-size: 25px;
color: #000;
padding: 5px;
border-radius: 50%;
line-height: 25px;
}
.map {
float: right;
padding-right: 35px;
padding-bottom: 100px;
}
.divFooter {
background-color: #b30000;
height: 270px;
width: 500%;
float: left;
}
/* Style the list */
ul.breadcrumb {
padding: 10px 16px;
list-style: none;
background-color: #eee;
font-size: 17px;
}
/* Display list items side by side */
ul.breadcrumb li {
display: inline;
}
/* Add a slash symbol (/) before/behind each list item */
ul.breadcrumb li+li:before {
padding: 8px;
color: black;
content: "/\00a0";
}
/* Add a color to all links inside the list */
ul.breadcrumb li a {
color: #0275d8;
text-decoration: none;
}
/* Add a color on mouse-over */
ul.breadcrumb li a:hover {
color: #01447e;
text-decoration: underline;
}
i'm really not that good with html/css but i try my best to achieve the results i want. i'm creating an online resume for me adapting a source code i downloaded but i'm having some trouble making it the way i want.
this is how i was hoping it to look like: http://i.stack.imgur.com/ozuEs.jpg
this is how it looks right now: http://fernandocysneiros.com/contrate
i dont know what i'm doing wrong. can anyone please help me? i searched before asking but got no luck. i'll paste the css and the header html here.
css:
<style>
img {
max-width: 100%;
max-height: 100%;
}
.msg { padding: 10px; background: #222; position: relative; }
.msg h1 { color: #fff; }
.msg a { margin-left: 20px; background: #408814; color: white; padding: 4px 8px; text-decoration: none; }
.msg a:hover { background: #266400; }
/* //-- yui-grids style overrides -- */
body { font-family: Georgia; color: #444; }
#inner { padding: 10px 80px; margin: 80px auto; background: #f5f5f5; border: solid #666; border-width: 8px 0 2px 0; }
.yui-gf { margin-bottom: 2em; padding-bottom: 2em; border-bottom: 1px solid #ccc; }
/* //-- header, body, footer -- */
#hd { margin: 2.5em 0 3em 0; padding-bottom: 1.5em; border-bottom: 1px solid #ccc }
#hd h2 { text-transform: uppercase; letter-spacing: 2px; }
#bd, #ft { margin-bottom: 2em; }
/* //-- footer -- */
#ft { padding: 1em 0 5em 0; font-size: 92%; border-top: 1px solid #ccc; text-align: center; }
#ft p { margin-bottom: 0; text-align: center; }
/* //-- core typography and style -- */
#hd h1 { font-size: 260%; text-transform: uppercase; letter-spacing: 3px; }
h2 { font-size: 152% }
h3, h4 { font-size: 122%; }
h1, h2, h3, h4 { color: #333; }
p { font-size: 100%; line-height: 18px; padding-right: 3em; }
a { color: #990003 }
a:hover { text-decoration: none; }
strong { font-weight: bold; }
li { line-height: 24px; border-bottom: 1px solid #ccc; }
p.enlarge { font-size: 144%; padding-right: 6.5em; line-height: 24px; }
p.enlarge span { color: #000 }
.contact-info { margin-top: 7px; }
.first h2 { font-style: italic; }
.last { border-bottom: 0 }
/* //-- section styles -- */
a#pdf { display: block; float: left; background: #666; color: white; padding: 6px 50px 6px 12px; margin-bottom: 6px; text-decoration: none; }
a#pdf:hover { background: #222; }
.job { position: relative; margin-bottom: 1em; padding-bottom: 1em; border-bottom: 1px solid #ccc; }
.job h4 { position: absolute; top: 0.35em; right: 0 }
.job p { margin: 0.75em 0 3em 0; }
.last { border: none; }
.skills-list { }
.skills-list ul { margin: 0; }
.skills-list li { margin: 3px 0; padding: 3px 0; }
.skills-list li span { font-size: 152%; display: block; margin-bottom: -2px; padding: 0 }
.talent { width: 32%; float: left }
.talent h2 { margin-bottom: 6px; }
#srt-ttab { margin-bottom: 100px; text-align: center; }
#srt-ttab img.last { margin-top: 20px }
.perfil {
display: block;
float: left;
height:130px;
overflow:visible;
margin-bottom: 2em;
padding-bottom: 2em;
border-bottom: 1px
}
/* --// override to force 1/8th width grids -- */
.yui-gf .yui-u{width:80.2%;}
.yui-gf div.first{width:12.3%;}
</style>
html:
<body>
<div id="doc2" class="yui-t7">
<div id="inner">
<div id="hd">
<div class="yui-u">
<div class="perfil" height="130px" vertical-align="center">
<h1>FERNANDO</h1>
<h1>CYSNEIROS</h1>
</div>
<div class="perfil" height="130px" vertical-align="center">
<img src="http://i.imgur.com/9qTYVst.jpg">
</div>
<div class="perfil">
<table>
<tr>
<td align="right"><font color="#cccccc"><i><b>telefone</b></i></font></td>
<td align="left">+55 (81) 8173-8769</td>
</tr>
<tr>
<td align="right"><font color="#cccccc"><i><b>e-mail</b></i></font></td>
<td align="left">me#fernandocysneiros.com</td>
</tr>
<tr>
<td align="right"><font color="#cccccc"><i><b>linkedin</b></i></font></td>
<td align="left">linkedin.com/in/fcysneiros</td>
</tr>
<tr>
<td align="right"><font color="#cccccc"><i><b>portfólio</b></i></font></td>
<td align="left">fernandocysneiros.com</td>
</tr>
</table>
</div><!--// .contact-info -->
</div><!--// .yui-gc -->
</div><!--// hd -->
Please add these styles at the bottom of your template's stylesheet:
.perfil:first-child {
width: 370px;
}
#hd h1 {
font-size: 450%;
}
.perfil:nth-child(2) {
margin: 0px 25px;
}
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.