I've been stuck on this for a while. Please see image attached. I need to make a circle with a centered letter inside it and a line to text aligned centre to the circle. I need help with rest of the code.
.lettercircle {
font-family: Helvetica, sans-serif;
background-color: #009cda;
color: #fff;
padding: 5px 12px;
border-radius: 50%;
font-size: 28px;
}
#div {
width: 499px;
height: 166px;
}
<div id="div">
<ul>
<li> <span>A</span>
DREAMWEAVER
</li>
<li> <span>B</span>
PHOTOSHOP
</li>
</ul>
</div>
How about this:
.lettercircle {
font-family: Helvetica, sans-serif;
background-color: #333;
color: #fff;
padding: 5px 9px;
border-radius: 50%;
font-size: 12px;
display: table-cell;
vertical-align: middle;
}
.title {
padding-left: 10px;
display: table-cell;
vertical-align: middle;
}
#div {
width: 499px;
background: red;
height: 100%;
padding: 10px;
}
#div > ul {
padding: 0;
display: table-cell;
vertical-align: middle;
}
#div > ul > li {
list-style: none;
padding: 10px;
font-family: Helvetica, sans-serif;
text-transform: uppercase;
display: table;
}
<div id="div">
<ul>
<li>
<span class="lettercircle">A</span>
<span class="title">DREAMWEAVER</span>
</li>
<li>
<span class="lettercircle">B</span>
<span class="title">PHOTOSHOP</span>
</li>
</ul>
</div>
I think you just forgot to add your class to your spans.
.lettercircle {
font-family: Helvetica, sans-serif;
background-color: #009cda;
color: #fff;
padding: 5px 12px;
border-radius: 50%;
font-size: 28px;
}
#div {
width: 499px;
height: 166px;
}
<div id="div">
<ul>
<li> <span class="lettercircle">A</span>
DREAMWEAVER
</li>
<li> <span class="lettercircle">B</span>
PHOTOSHOP
</li>
</ul>
</div>
Related
Beginner to CSS and I'm trying to build a Nav;
So far I have the following CSS code. I want the .btn font color to be white. I've tried using !important; but also not working.
any ideas what is overriding the font color and what I can do to change it?
/* navigation */
nav {
width: 503px;
height: 45px;
font-family: Roboto;
font-size: 16px;
font-weight: 500;
float: right;
color: #646881;
}
nav li {
display: inline;
padding-right: 20px;
}
nav a:link {
color: #646881;
}
nav a:hover {
color: #646881
font-style: italic;
}
nav a:active {
color: #646881;
}
nav a:visited {
color: #646881;
}
img.logo{
max-height: 45px;
max-width: 105px;
border-top: 40px;
margin-left: 60px;
float: left;
padding: 5px;
}
.btn {
background-color: #646881;
width: 75px;
border-radius: 4%;
border: none;
color: #ffffff;
}
HTML
Yes, sorry here is the HTML:
<header role="header">
</div>
<img border="0" class="logo" src="/assets/images/logo.png" alt="David Bowie Personas Logo">
<!-- Nav-->
<nav id="MainMenu" role="navigation">
<ol>
<li>
About
</li>
....
<li>
Shop
</li>
</ol>
</nav>
</header>
/* navigation */
nav {
width: 503px;
height: 45px;
font-family: Roboto;
font-size: 16px;
font-weight: 500;
float: right;
color: #646881;
}
nav li {
display: inline;
padding-right: 20px;
}
nav a:hover {
color: #646881
font-style: italic;
}
img.logo{
max-height: 45px;
max-width: 105px;
border-top: 40px;
margin-left: 60px;
float: left;
padding: 5px;
}
a.btn {
background-color: #646881;
width: 75px;
border-radius: 4%;
border: none;
color: #ffffff;
display: block;
padding: 10px;
text-align: center;
}
<header role="header">
<img border="0" class="logo" src="/assets/images/logo.png" alt="David Bowie Personas Logo">
<!-- Nav-->
<nav id="MainMenu" role="navigation">
<ol>
<li>
About
</li>
....
<li>
Shop
</li>
</ol>
</nav>
</header>
You are referring to an HTML-tag with nav i assume that you got a div-element with a class-name, in that case you shall use a dot .nav
I am a beginner, and I am having trouble recreating my mockup in CSS. One issue is the second section of my homepage (benefits). I wanted a two column checkerboard layout alternating white and cardboard backgrounds. I'm not sure if the answer is to change the media queries or include more subclasses. I'm generally lost on this. Here is my mockup. Thank you in advance.
Did I mention that you have to speak to me as if I am 5 years old?
html,
body {
overflow-x: hidden;
}
body {
font-family: "Montserrat", Helvetica, Arial, sans-serif;
font-weight: 100;
color: #1F1309;
}
/* HEADER */
header {
color: #FFFFFF;
}
header .logo {
float: left;
}
header nav {
padding: 1em 0;
}
header nav ul {
display: inline;
text-align: right;
float: right;
margin: 0;
}
header nav ul>li {
list-style-type: none;
display: inline-block;
margin: 0 15px;
}
header nav ul>li.btn-outline {
padding: 10px 15px;
border: 2px solid #FFFFFF;
border-radius: 4px;
}
header nav ul>li.btn-outline:hover {
background: #FFFFFF;
}
header nav ul>li>a {
color: #FFFFFF;
text-decoration: none;
}
header nav ul>li.btn-outline:hover>a {
color: #845F5A;
}
header .headline {
text-align: center;
display: block;
text-align: center;
padding-bottom: 95px;
}
header .headline h1 {
font-size: 48px;
font-weight: normal;
margin: 95px 0 0;
}
header .headline p {
font-size: 22px;
line-height: 26px;
font-weight: 100;
margin: 10px 0 40px;
}
header,
footer,
section {
overflow: auto;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Crimson Text", Helvetica, Arial, serif;
color: white;
}
h2 {
font-size: 48px;
font-weight: normal;
margin-bottom: 20px;
line-height: 1.5em;
}
p {
font-size: 16px;
line-height: 19px;
font-weight: 100;
}
/* GRID */
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
.container:before,
.container:after {
content: " ";
display: table;
}
.container:after {
clear: both;
}
.one-half,
.one-third,
.one-fourth {
width: 96%;
float: left;
position: relative;
min-height: 1px;
margin: 0 2% 20px;
}
/*IMAGES*/
.hero {
vertical-align: top;
background-image: url("images/brainstorm.png");
background-size: cover;
position: relative;
}
.overlay {
position: relative;
}
.overlay:before {
position: absolute;
content: " ";
top: 0;
left: 0;
width: 500%;
height: 100%;
display: none;
z-index: 0;
}
.overlay:hover:before {
display: block;
}
.black:before {
background-color: #000000;
opacity: .35;
}
.brown:before {
background-color: #7E6233;
}
.hero * {
position: relative;
/* hack */
}
/* BUTTONS */
.btn {
border-radius: 4px;
color: #FFFFFF;
font-weight: 700;
text-decoration: none;
padding: 10px 30px;
background: #F9461C;
box-shadow: 0 2px 4px 2px rgba(71, 19, 7, 0.90);
;
}
.container-second-hero {
vertical-align: top;
height: 287px;
background-image: url("images/Guy-on-grass.png");
background-size: cover;
position: relative;
}
.benefits {
background-image: url("images/cardboard.png");
background-repeat: repeat;
display: block;
position: relative;
color: #1F1309;
text-align: center;
height: 100%;
}
.benefits ul li {
list-style-type: none;
display: inline-block;
}
.benefits i {
color: #1F1309;
font-size: 144px;
margin: 0;
border: 0;
vertical-align: middle;
display: block;
height: 336px;
width: 100%;
}
.benefits h2 {
color: #1F1309;
font-size: 48px;
font-weight: bold;
}
.benefits p {
font-size: 24px;
line-height: 1.5em;
}
.additional-features {
background-image: url("images/cardboard.png");
background-repeat: repeat;
text-align: center;
display: block;
padding-bottom: 72px;
display: table;
width: 100%;
}
.additional-features h1 {
display: table-cell;
vertical-align: center;
text-align: center;
}
.additional-features h3 {
font-family: "Crimson Text", Helvetica, Arial, sans-serif;
color: #1F1309;
font-size: 36px;
}
.additional-features ul {
color: #1F1309;
font-size: 18px;
line-height: 1.5em;
font-weight: 100;
list-style: none;
}
/* PRICING */
.pricing {
background: #FFFFFF;
padding: 4em 0;
text-align: center;
padding: 4em 0;
}
.pricing h2,
.pricing h3,
.pricing h4,
.pricing p {
color: #1F1309;
line-height: 0.5em;
}
.pricing ul {
margin: 0 auto;
padding: 2em 0;
}
.pricing ul li {
list-style-type: none;
}
.pricing .container p {
line-height: 1.5em;
}
.box {
padding: 0 0 15px;
background: rgba(124, 49, 70, 0.18);
border: 1px solid #979797;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.20);
min-height: 439px;
position: relative;
margin-top: 25px;
width: 100%;
}
.box.middle {
border: 1px solid rgba(31, 19, 8, 0.55);
box-shadow: 0 2px 0 1px rgba(46, 60, 65, 0.52);
background: #FFFFFF;
min-height: 485px;
margin-top: 0px;
width: 110%;
}
.box h3 {
font-family: "Crimson Text", Helvetica, Arial, sans-serif;
font-weight: 600;
font-size: 48px;
}
.box h4 {
font-size: 50px;
font-weight: normal;
margin: 40px 0 10px;
color: #1F1309;
text-transform: uppercase;
}
.box h4 span {
font-size: 32px;
vertical-align: top;
}
.box h4 span.month {
font-family: "Crimson Text", Helvetica, Arial, sans-serif;
font-weight: 100;
color: #1F1309;
font-size: 20px;
vertical-align: middle;
}
.box ul li {
font-size: 18px;
margin-bottom: 20px;
font-weight: 100;
}
.box .btn {
position: absolute;
bottom: 60px;
left: 40px;
right: 40px;
}
.small {
font-size: 12px;
color: #FEFEFE;
line-height: 15px;
font-style: italic;
}
/* TESTIMONIALS */
.testimonials {
padding: 4em 0;
text-align: center;
}
.testimonials h2 {
color: #1F1309;
}
.testimonials ul li {
list-style-type: none;
}
.testimonials blockquote {
color: #FFFFFF;
text-align: left;
font-style: italic;
background: #1F1309;
position: relative;
padding: 30px;
width: auto;
margin: 0;
}
.testimonials blockquote:after {
top: 100%;
left: 13%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-top-color: #1F1309;
border-width: 10px;
margin-left: -10px;
}
.testimonials img {
height: 65px;
width: 65px;
border-radius: 50%;
float: left;
display: inline-block;
margin: 20px 10px 0 0;
}
.testimonials p.name {
float: left;
display: inline-block;
text-align: left;
font-size: 13px;
margin-top: 30px;
}
.testimonials .second,
.fourth {
position: relative;
top: 20px;
}
/* FOOTER */
footer {
background-color: #34495E;
background-image: linear-gradient(to top, #3498DB 0%, #3498DB 50%, #34495E 50%, #34495E 100%);
color: #FFFFFF;
height: 150px;
position: relative;
overflow: hidden;
z-index: 0;
}
footer p,
footer nav ul {
font-size: 14px;
font-weight: 100;
text-align: center;
margin: 10px auto 0;
}
footer nav ul li {
list-style-type: none;
display: inline;
}
footer nav ul li a {
color: #FFFFFF;
text-decoration: none;
}
footer .right-footer-block {
background-color: transparent;
}
footer .logo {
padding: 2.35em 0;
margin: 0 auto;
display: block;
}
#media (min-width: 992px) {
footer {
background-color: #3498DB;
background-image: linear-gradient(to left, #3498DB 0%, #3498DB 33.33337%, #34495E 33.33337%, #34495E 100%);
height: 100px;
}
footer p,
footer nav ul {
padding: 2em 0;
text-align: left;
}
footer .right-footer-block {
background-color: #3498DB;
}
footer .logo {
padding: 2em 0 2em 1.5em;
}
}
#media (min-width: 768px) {
.container {
width: 750px;
}
}
#media (min-width: 992px) {
.container {
width: 970px;
}
.one-half {
width: 46%;
}
.one-third {
width: 32.64177%;
padding-left: 0;
padding-right: 0;
margin-left: 0;
margin-right: 0;
}
.one-fourth {
width: 21%;
}
}
#media (min-width: 1200px) {
.container {
width: 1170px;
}
}
#media (min-width: 4000px) {
.container {
width: 3800px;
}
html {
font-size: 150% line-height: 150%
}
}
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="X-UZ-Compatible" content="IE=Edge">
<meta charset="UTF-0">
<title>Save, share, and collaborate | Blockbox</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Crimson+Text:400,400i,600,600i,700,700i|Montserrat:400,700" rel="stylesheet">
<!-- CSS -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/font-awesome.css">
<link rel="stylesheet" href="css/animate.css" </head>
<body>
<!-- Hero -->
<header>
<div class="hero overlay black">
<nav class="container">
<div class="one-half">
<img src="images/site-white-logo.png" alt="Blocbox" />
</div>
<div class="one-half">
<ul>
<li>Sign In</li>
<li class="btn-outline">Sign Up</li>
</ul>
</div>
</nav>
<div class="container headline">
<h1 class="animated fadeIn">Save, share and collaborate.</h1>
<p>blocbox lets you collect and sort information.<br/>Create simple notes, store images, and add links.</p>
Start Your Free Trial!
</div>
</div>
</header>
<main role="main">
<!-- Benefits -->
<section class="benefits">
<ul class="container">
<li class="one-half">
<div class="top">
<h2>Create notes</h2>
<p>Using Markdown, you can create simple text-based documents to save and share. You can collaborate with others to write and edit content.</p>
</div>
<i class="fa fa-file-o"></i>
<div class="bottom">
<h2>Add Links</h2>
<p>Forget bookmarking sites in your browser. With blocbox, you can add links, group them and view them from any computer.</p>
</div>
</li>
<li class="one-half">
<i class="fa fa-picture-o"></i>
<div class="middle">
<h2>Save images</h2>
<p>Are there images you find interesting enough to save? Now you have a way to organize and store those within blocbox.</p>
</div>
<i class="fa fa-link"></i>
</ul>
</section>
<!-- Additional Features -->
<section class="additional-features">
<div class="container-second-hero">
<h1>Access blocbox anywhere.</h1>
</div>
<ul class="container">
<li class="one-third">
<h3>Collaborate</h3>
<ul>
<li>Invite collaborators</li>
<li>Chat in real time</li>
</ul>
</li>
<li class="one-third">
<h3>Organize</h3>
<ul>
<li>Tag items</li>
<li>Search for items</li>
<li>Create boxes</li>
</ul>
</li>
<li class="one-third">
<h3>Do</h3>
<ul>
<i class="fa-calendar-check-o"></i>
<li>Assign due dates</li>
<i class="fa-clock-o"></i>
<li>Set reminders</li>
</ul>
</li>
</ul>
</section>
<!-- Pricing -->
<section class="pricing">
<div class="container">
<h2>How much does blocbox cost?</h2>
<p>We have many options to fit your needs. It's free to try for 30 days*, and you can always change your plan once you signed up. <br/>Here are the different features of each plan:</p>
</div>
<ul class="container">
<li class="one-third">
<div class="box">
<h3>Casual</h3>
<h4>Free</h4>
<ul>
<li>Up to 5 boxes</li>
<li>Up to 10 collaborators</li>
<li><strong>2GB</strong> of storage</li>
</ul>
Start Your Free Trial!
</div>
<li class="one-third">
<div class="box middle">
<h3>Professional</h3>
<h4><span>$</span>5<span class="month">/month</span></h4>
<ul>
<li>Unlimited boxes</li>
<li>Up to 20 collaborators</li>
<li><strong>5GB</strong> of storage</li>
<li>Real-time collaboration</li>
</ul>
Start Your Free Trial!
</div>
</li>
<li class="one-third">
<div class="box">
<h3>Expert</h3>
<h4><span>$</span>10<span class="month">/month</span></h4>
<ul>
<li>Unlimited boxes</li>
<li>Unlimited collaborators</li>
<li><strong>Unlimited</strong> storage</li>
<li>Real-time collaboration</li>
</ul>
Start Your Free Trial!
</div>
</li>
</ul>
</section>
<!-- Testimonials -->
<section class="testimonials">
<div class="container">
<h2>Who uses blocbox?</h2>
<p>blocbox has more than 100,000 satisfied users storing and collaborating<br/> with teams across the world. Here's what a few have to say:</p>
</div>
<ul class="container">
<div class="first">
<li class="one-fourth">
<blockquote>"blocbox has made it easier to find and keep things I love. I can share with other designers on my team and create new categories with awesome stuff. And creating simple text documents couldn't be easier."
</blockquote>
<img src="https://pbs.twimg.com/profile_images/620606106142806016/_80ZF1Qd.jpg" alt="avatar">
<p class="name"><strong>Abinav Thakuri</strong><br/>Freelance Designer, N. Dakota</p>
</div>
</li>
<li class="one-fourth second">
<div class="second">
<blockquote>"blocbox has made it easier to find and keep things I love. I can share with other designers on my team and create new categories with awesome stuff. And creating simple text documents couldn't be easier."
</blockquote>
<img src="https://pbs.twimg.com/profile_images/620606106142806016/_80ZF1Qd.jpg" alt="avatar">
<p class="name"><strong>Abinav Thakuri</strong><br/>Freelance Designer, N. Dakota</p>
</div>
</li>
<li class="one-fourth third">
<blockquote>"blocbox has made it easier to find and keep things I love. I can share with other designers on my team and create new categories with awesome stuff. And creating simple text documents couldn't be easier."
</blockquote>
<img src="https://pbs.twimg.com/profile_images/620606106142806016/_80ZF1Qd.jpg" alt="avatar">
<p class="name"><strong>Abinav Thakuri</strong><br/>Freelance Designer, N. Dakota</p>
</li>
<li class="one-fourth fourth">
<div class="fourth">
<blockquote>"blocbox has made it easier to find and keep things I love. I can share with other designers on my team and create new categories with awesome stuff. And creating simple text documents couldn't be easier."
</blockquote>
<img src="https://pbs.twimg.com/profile_images/620606106142806016/_80ZF1Qd.jpg" alt="avatar">
<p class="name"><strong>Abinav Thakuri</strong><br/>Freelance Designer, N. Dakota</p>
</div>
</li>
</ul>
</section>
<!-- Call to Action -->
<section class="CTA">
<div class="container">
<h2>Ready to give it a try?</h2>
<p>We have many options to fit your needs. It's free to try for 30 days*, and you can always change your plan once you signed up.</p>
Start Your Free Trial!
</div>
<!-- Footer -->
<footer>
<div class="container footer-nav-block">
<div class="left-footer-block one-third">
<p class="copyright-block">© 2015. <strong>Blocbox</strong> - All Rights Reserved.</p>
</div>
<nav class="link-block middle-footer-block one-third">
<ul>
<li>Terms</li> /
<li>Privacy Policy</li> /
<li>Contact Us</li> /
<li>About Us</li> /
<li>Twitter</li>
</ul>
</nav>
<div class="right-footer-block one-third">
<img class="logo" src="images/site-brown-logo.png" alt="Blocbox" />
</div>
</div>
</footer>
</main>
</body>
</html>
</body>
</html>
You could just make it a table, and use CSS to set the background using some nth-child logic.
To center your text you can use flex boxes with a container inside of it, I just made it a div and marked it as display:inline-block; with some CSS.
Since I'm pretty sure your cardboard is an image, all you'd have to do is to replace the background-color:rgb(###,###,###); by a background-image element.
and you should be it.
table.Container{
width:100%;
}
table.Container td{
display:inline-flex;
text-align:center;
align-items:center;
justify-content:center;
vertical-align:middle;
height:2in;
flex-direction:row;
box-sizing:border-box;
width:50%;
}
table.Container td > div{
display:inline-block;
}
table.Container tr:nth-child(odd) > td:nth-child(odd),
table.Container tr:nth-child(even) > td:nth-child(even){
background-color:rgb(219, 148, 50);
}
table.Container tr:nth-child(even) > td:nth-child(odd),
table.Container tr:nth-child(odd) > td:nth-child(even){
background-color:white;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<table class="Container">
<tbody>
<tr>
<td><div>your ontent here</div></td>
<td><div>your ontent here</div></td>
</tr>
<tr>
<td><div>your ontent here</div></td>
<td><div>your ontent here</div></td>
</tr>
<tr>
<td><div>your ontent here</div></td>
<td><div>your ontent here</div></td>
</tr>
</tbody>
</table>
</body>
</html>
I'm pretty new to HTML5 and CSS3 and I've been developing a new website for my NGO. I'm pretty much done all the design, but I can't get my drop down menu to work in IE, and I can't get the Google Font I'm using to work in IE or Firefox.
I have a drop down menu with the org logo in the middle and the menu text floating at the vertical center of the logo on either side. In Chrome this works just as I want it to, but when I open it in IE11 the menu text is floating at the very top of the page, and the drop down boxes don't line up correctly. All of it lines up correctly in Firefox, but the Google Font 'Lato' that I'm using only works in Chrome.
Here is the HTML for the header:
/* Header */
* {margin: 0;padding: 0 ;outline: none;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;-o-box-sizing: border-box;-ms-box-sizing: border-box;box-sizing: border-box;}
*:after, *:before { -webkit-box-sizing: border-box;-moz-box-sizing: border-box;-o-box-sizing: border-box;-ms-box-sizing: border-box;box-sizing: border-box;}
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section { display: block; }
html {font-size: 60%;height: auto; !important;height: 100%;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;-o-box-sizing: border-box;-moz-box-sizing: border-box; }
.clear {display: block; }
.clear::after {clear: both;content: ".";display: block;height: 1px;visibility: hidden;}
/*GENERIC STYLES*/
body {background: url('../images/bg-tile-grey-2.png') font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 1.05em;font-weight: 400;height: auto !important;height: 100%;min-height: 100%;}
/*NAV*/
#logo {
display: inline;
margin: 0 auto;
padding: 0;
}
.menu {
position: relative;
}
#search {
float: left;
position: absolute;
}
#searchbox {
padding: 16px 15px 16px 15px;
font-family: 'Lato', Helvetica, Arial, sans-serif;
margin-left: 0;
color: #603a16;
position: relative;
right: -5px;
border: none;
border-color: white;
}
#go {
padding: 8px;
font-size: 1.5rem;
font-family: 'Lato', Helvetica, Arial, sans-serif;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: bolder;
color: transparent;
background: url('../images/magnifying-glass.png') top right no-repeat;
border: #74b648;
margin-right: 0;
}
.facebook {
height: 32px;
width: 32px;
background: url('../images/facebook_colour_32-03.png') top right no-repeat;
text-indent: -9999px;
margin: 0 15px 0 10px;
display: inline-block;
float: right;
box-shadow: none;
border: none;
}
.twitter {
height: 32px;
width: 32px;
background: url('../images/twitter_colour_32-03.png') top right no-repeat;
text-indent: -9999px;
display:inline-block;
float: right;
}
.donate {
position: relative;
right:-695px;
}
header {
display: block;
width: 100%;
text-align: center;
}
header > nav > ul {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
list-style: none;
margin: 0;
padding: 0;
}
header > nav > ul > li {
flex: 0 1 auto;
margin: auto;
padding: 0;
position: relative;
transition: all linear 0.1s;
}
header > nav > ul > li:hover {
background-color: white;
}
header > nav > ul > li a + div {
background: white;
border-radius: 0 0 2px 2px;
box-shadow: 0 3px 1px rgba(0,0,0,.05);
display: none;
font-size: 1.1rem;
color: #603a16;
padding: .25rem 1.5rem;
letter-spacing: 1.5px;
text-transform: uppercase;
text-align: left;
position: absolute;
width: 220px;
}
header > nav > ul > li:hover a + div {
display: block;
}
header > nav > ul > li a + div > ul {
list-style-type: none;
}
header > nav > ul > li a + div > ul > li {
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
font-smoothing: antialiased;
font-family: 'Lato', Helvetica, sans-serif;
font-weight: bolder;
line-height: 2rem;
}
header > nav > ul > li a + div > ul > li > a {
color: #603a16;
display: block;
font-size: 1.1rem;
letter-spacing: 1.5px;
padding: .25rem 1.5rem;
text-decoration: none;
text-transform: uppercase;
width: 200px;
background: white;
}
header > nav > ul > li a + div > ul > li:hover > a {
background-color: #bbbbbb;
}
header > nav > ul > li > a {
color: #603a16;
display: block;
font-size: 1.7rem;
max-width: 500px;
padding: .9rem ;
text-decoration: none;
font-weight: ;
text-transform: uppercase;
transition: all linear 0.1s;
text-align: center;
margin-right: auto;
margin-left: auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
font-smoothing: antialiased;
font-family: "Lato", Helvetica, Arial, sans-serif;
font-weight: bolder;
}
header > nav > ul > li > a > div > span {
color: rgba(255,255,255,.75);
display: block;
font-family: "Lato", Helvetica, Arial, sans-serif;
font-size: .7rem;
font-style: italic;
line-height: 1rem;
max-width: 260px;
}
<header class="main">
<nav role="navigation">
<ul style="position:relative; z-index:90;">
<li class="menu">
<a href="/about/index.html">
<div>
About
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Member Groups</li>
<li>Board of Directors</li>
<li>Bulletin</li>
<li>Brochure</li>
<li>Join</li>
<li>Contact</li>
</ul>
</div>
</li>
<li>
<li class="menu">
<a href="/events/index.html">
<div>
Events
</div>
</a>
<div>
<ul style="position:relative; z-index:99;">
<li>SEN World Rivers Day</li>
<li>SEN Environmental Film Festival</li>
<li>SEN Earth Overshoot</li>
<li>SEN Environmental Activist Awards</li>
<li>Events Calendar</li>
</ul>
</div>
</li>
<li>
<li class="menu">
<a href="/tools/index.html">
<div>
Tools
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Group Tools</li>
<li>Campaign Tools</li>
<li>Laws</li>
<li>Government Contacts</li>
<li>SEN's Grassroots Activism Fund</li>
</ul>
</div>
</li>
<li class="menu">
<a href="/solutions/energy/index.html">
<div>
Solutions
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Energy Policy</li>
<li>Energy Conservation and Efficiency</li>
<li>Alternate Energy Resources</li>
</ul>
</div>
</li>
<li class="menu">
<a href="/index.html">
<div id="top-logo">
<img src="images/EcoNet_logo_head2.png" height="180" width="180" title="Saskatchewan_Eco_Network" alt="Saskatchewan Eco Network">
</div>
</a>
</li>
<li class="menu">
<a href="/issues/index.html">
<div>
Issues
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Biodiversity</li>
<li>Biotechnology</li>
<li>Climate Change</li>
<li>Ethanol</li>
<li>Forests</li>
<li>Great Sand Hills</li>
<li>Intensive Livestock Operations</li>
<li>Mining</li>
<li>Pesticides</li>
<li>Water</li>
</ul>
</div>
</li>
<li>
<li>
<li class="menu">
<a href="/action/index.html">
<div>
Action
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Find your Representitive</li>
<li>Write a Letter to the Editor</li>
</ul>
</div>
</li>
<li>
<li>
<li class="menu">
<a href="/ecoed/index.html">
<div>
Eco-Education
</div>
</a><div>
<ul style="position:relative; z-index:99;">
<li>Teacher Resources</li>
<li>Eco-Education Stories</li>
<li>Indigenous Educators</li>
<li>Student Resources</li>
</ul>
</div>
</li>
<li>
</ul>
</nav>
</header>
and here is the CSS for the Header
The menu is in the correct position in Firefox, but the Google Font 'Lato' still isn't working correctly. Does anybody know what I'm doing wrong with my HTML and CSS that the menu and font are only working properly in Chrome?
I have created three blocks using the html code as shown below. The "a" tag has the min-height css property because of which it will be displayed as block. I am not able to place the text inside the span tag in the center of "li" tag. Although each text inside the tag is of different length, I want to display them in the center.
<div class="container">
<div class="col-md-12">
<ul id="tabs" class="nav-tabs">
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Data</span>
</a>
</li>
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Charts</span>
</a>
</li>
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Reports</span>
</a>
</li>
</div>
</div>
CSS:
.container ul {
list-style: none outside none;
}
li {
display: list-item;
}
.col-md-4 {
width: 33%;
}
.nav-block {
background-color: #FFA500;
display: block;
min-height: 70px;
position: relative;
}
.container .nav-block .header {
color: #FFFFFF;
font-size: 2em;
font-weight: bold;
left: 20%;
padding: 5px;
position: relative;
text-align: center;
top: 21%;
}
Please let me know where I am going wrong
just changed the css to center the texts, check in the fiddle
.nav-block {
background-color: #FFA500;
display: block;
min-height: 70px;
position: relative;
text-align: center;
}
.container .nav-block .header {
color: #FFFFFF;
font-size: 2em;
font-weight: bold;
padding: 5px;
position: relative;
text-align: center;
top: 21%;
}
You should set the text-align:center; on the li{}
And delete the position:relative; on .container .nav-block .header {
DEMO
With editting my sugestions you have a shorter css, because you can delete the unaccecary things. Like here.
.container .nav-block .header {
color: #FFFFFF;
font-size: 2em;
font-weight: bold;
padding: 5px;
}
DEMO 2 (same as the other but less css)
Try this below css.
.nav-block {
background-color: #FFA500;
display: block;
min-height: 70px;
position: relative;
text-align: center; /*New Edit*/
}
.container .nav-block .header {
color: #FFFFFF;
font-size: 2em;
font-weight: bold;
/*left: 20%; - Remove*/
padding: 5px;
position: relative;
text-align: center;
top: 21%;
}
just add text-align:center; to .nav-tabs or .nav-block
You aren't closing your <ul> tag.
I hope this is what you want ->
DEMO
HTML
<div class="container">
<div class="col-md-12">
<ul id="tabs" class="nav-tabs">
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Data</span>
</a>
</li>
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Charts</span>
</a>
</li>
<li class="col-md-4 nav-list">
<a href="#" class="nav-block">
<span class="header">Reports</span>
</a>
</li>
<!--closing the ul tag-->
</ul>
</div>
</div>
CSS
.container ul {
list-style: none outside none;
}
li {
display: list-item;
}
.col-md-4 {
width: 33%;
}
.nav-block {
background-color: #FFA500;
display: block;
min-height: 70px;
position: relative;
text-align:center; /*aligning the text center*/
line-height:60px; /*this gives vertical alignment to your element*/
}
.container .nav-block .header {
color: #FFFFFF;
font-size: 2em;
font-weight: bold;
left: 0; /*removed the defined 20% to center you text inside anchor <a> tags*/
padding: 5px;
position: relative;
text-align: center;
top: 21%;
}
I want to align the list items horizontally. But i'm not getting them in a line. If i remove the br tag inside the first li then its aligning perfectly. What am i missing? please help. jsfiddle code -> here
html:
<div id="info_new_cont">
<ul id="info_new_ul">
<li id="app_no_li">
<div>
<div id="app_no_title">Appn<br> No:</div>
<div id="app_no" class="info_new_bottom">42382464</div>
</div>
</li>
<li id="new_li">
<div>mcs</div>
<div id="new_case" class="info_new_bottom">New Case</div>
</li>
<li id="ifw_li">
<div>ld</div>
<div id="file_wrap" class="info_new_bottom">More Info</div>
</li>
</ul>
</div>
here is the style
#info_new_cont {
float: right;
display: inline-block;
width: 500px;
height: 100%;
margin: 0px;
}
#info_new_ul {
list-style: none;
margin: 0px;
width: 400px;
height: 140px;
}
#info_new_ul li {
display: inline-block;
padding: 5px;
color: #fff;
font-family: trebuchet ms;
font-size: 19px;
font-weight: lighter;
text-align: justify;
word-wrap:break-word;
}
.info_new_bottom {
margin-top:30px;
}
#app_no_li {
width: 120px;
height: 120px;
background-color: #00ddff;
}
#app_no_cont {
white-space: nowrap;
}
#app_no_title {
}
#app_no {
font-weight: bold;
}
#new_li {
width: 120px;
height: 120px;
background-color: #eee;
}
#ifw_li {
width: 120px;
height: 120px;
background-color: #eee;
}
Delete the display: inline-block; from de #info_new_ul li
and use a float:left for the <li>.
#info_new_ul li {
....
float:left;
}
Your JsFiddle but updated with the new code
You should use float:left for li tags.
#info_new_ul li {
float:left;
margin-left: 2px;
padding: 5px;
color: #fff;
font-family: trebuchet ms;
font-size: 19px;
font-weight: lighter;
text-align: justify;
word-wrap:break-word;
}
DEMO