My a href inside a div is not working I saw that the width and height was 0px, so I tried to increase size, but it doesn't get increased.
Each dot is supposed to send you to another page in the onepage scroller I'm making
.dotstyle-scaleup{
float: right;
margin-right: 3%;
}
.dotstyle-scaleup li{
background-color: #eeeeee;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 80px 0 0 0;
list-style: none;
}
.dotstyle-scaleup #current1{
background-color: #54a59f;
width: 20px;
height: 20px;
border-radius: 50%;
margin: 80px 0 0 0;
list-style: none;
}
<div id="wrapper">
<!-- Landings -->
<div class="section" data-anchor="page1" style="background-color: red">
<div class="dotstyle-scaleup">
<ul>
<li id="current1"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
As the elements in question contain no content, declaring height and width properties won't be enough.
Consider declaring a display property, in addition to specifying a height and width property for the nested anchor elements (a) e.g:
.dotstyle-scaleup li a {
width: 100%;
height: 100%;
display: block;
}
Code Snippet Demonstration:
.dotstyle-scaleup {
float: right;
margin-right: 3%;
}
.dotstyle-scaleup li {
background-color: #eeeeee;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 80px 0 0 0;
list-style: none;
}
.dotstyle-scaleup #current1 {
background-color: #54a59f;
width: 20px;
height: 20px;
border-radius: 50%;
margin: 80px 0 0 0;
list-style: none;
}
/* Additional */
.dotstyle-scaleup li a {
width: 100%;
height: 100%;
display: block;
}
<div id="wrapper">
<!-- Landings -->
<div class="section" data-anchor="page1" style="background-color: red">
<div class="dotstyle-scaleup">
<ul>
<li id="current1">
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
</div>
Related
I cannot get hover to work on the dummy links in my CodePen. The cursor won’t even change to the hand icon. I am referring to the navigation bar, the dummy links do not work properly. Here is the CodePen
* {
box-sizing: border-box;
}
body {
width: 100%;
margin: 0 auto;
padding: 0;
background-image: url("wallpaper2.jpg");
background-repeat: repeat;
}
.header {
width: 100%;
background: black;
height: 100px;
color: white;
}
.wrapper {
margin: 0 auto;
width: 75%;
background: pink;
height: 1000px;
}
h1 {
margin: 0 auto;
position: relative;
top: 30px;
left: 15px;
font-size: 2em;
}
ul {
list-style-type: none;
float: right;
margin: auto;
}
li {
display: inline-block;
padding-left: 20px;
font-size: 1.4em;
}
.lastlist {
padding-right: 65px;
}
a:hover {
color: #f0c330;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="gallery.css">
</head>
<body>
<div class="header">
<nav>
<h1>Daniel Savva</h1>
<ul>
<li> Home </li>
<li> Gallery </li>
<li> About </li>
<li class="lastlist"> Contact </li>
</ul>
</nav>
</div>
<div class="wrapper"></div>
<div class="column"></div>
</body>
</html>
Your h1 tag is overlapping the ul tag
Solution is to add position:relative to your ul tag :)
Because Without any z-index value, elements stack in the order that they appear in the DOM and elements with non-static positioning ( relative ,absolute ..) will always appear on top of elements with default static positioning.
h1 : position:relative
ul : default static position
Adding position:relative will force your ul element to be on TOP.
* {
box-sizing: border-box;
}
body {
width: 100%;
margin: 0 auto;
padding: 0;
background-image: url("wallpaper2.jpg");
background-repeat: repeat;
}
.header {
width: 100%;
background: black;
height: 100px;
color: white;
}
.wrapper {
margin: 0 auto;
width: 75%;
background: pink;
height: 1000px;
}
h1 {
margin: 0 auto;
position: relative;
top: 30px;
left: 15px;
font-size: 2em;
}
ul {
list-style-type: none;
float: right;
margin: auto;
position : relative ;
}
li {
display: inline-block;
padding-left: 20px;
font-size: 1.4em;
}
.lastlist {
padding-right: 65px;
}
a:hover {
color: #f0c330;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="gallery.css">
</head>
<body>
<div class="header">
<nav>
<h1>Daniel Savva</h1>
<ul>
<li> Home </li>
<li> Gallery </li>
<li> About </li>
<li class="lastlist"> Contact </li>
</ul>
</nav>
</div>
<div class="wrapper"></div>
<div class="column"></div>
</body>
</html>
I'm having issues trying to align my list to the center of my page so that it'll match with the rest of my content. I've tried other ways but it either doesn't work or aligns to far to the right.
HTML:
<p>Digital Media:</p>
<div id="list">
<ul>
<li>Tablet</li>
<li>Tablet Pen</li>
<li>Phone + my finger</li>
</ul>
</div>
<p>Tradtional Media:</p>
<div id="list">
<ul>
<li>Notebook</li>
<li>Pens</li>
<li>Pencils</li>
<li>Colored Pencils</li>
<li>Fine-Tip Markers</li>
<li>Canvas</li>
<li>Watercolor Paint</li>
<li>Acrylic Paint</li>
<li>Various-Sized Paintbrushes</li>
</ul>
</div>
CSS:
ul {
margin: 0 auto;
width: 1200px;
padding-left: 0;
font-size: 0;
justify-content: center;
}
li {
font-size: 18px;
list-style-type: none;
width: 150px;
height: 50px;
line-height: 50px;
margin: 15px 25px;
box-sizing: border-box;
text-align: center;
}
You can change code:
li {
...
margin: 15px auto;
...
}
And in a page, don't should multi element with same ID
<div id="list"> => <div class="list">
You can try wrapping the lists in a div element and centering that. See w3schools’s article on css margins.
<style>
.center {
margin: 30px auto;
}
p {
text-align: center;
}
ul {
margin: 0 auto;
width: 150px;
padding-left: 0;
font-size: 0;
justify-content: center;
}
li {
font-size: 18px;
list-style-type: none;
width: 150px;
height: 50px;
line-height: 50px;
margin: 15px 25px;
box-sizing: border-box;
text-align: center;
}
</style>
<div class="center">
<p>Digital Media:</p>
<ul>
<li>Tablet</li>
<li>Tablet Pen</li>
<li>Phone + my finger</li>
</ul>
<p>Tradtional Media:</p>
<ul>
<li>Notebook</li>
<li>Pens</li>
<li>Pencils</li>
<li>Colored Pencils</li>
<li>Fine-Tip Markers</li>
<li>Canvas</li>
<li>Watercolor Paint</li>
<li>Acrylic Paint</li>
<li>Various-Sized Paintbrushes</li>
</ul>
</div>
I am able to correctly align the menu bar when the browser is not resized. Once i start zooming out , the content in the menu bar comes below , I am currently concentrating on zooming out the menu.
please advice me what must be the problem, and is there any way i can keep the menu items from wrapping .
<body>
<div id="wrapper">
<div id="header">
<div id="logo">CodePlayer </div>
<div id="run_btn"> <button id="run"> Run </button> </div>
<ul id="menu">
<li> HTML </li>
<li> CSS </li>
<li> JS </li>
<li> Result </li>
</ul>
<div class="clear"> </div>
</div>
</div>
</body>
CSS
body {
padding: 0;
margin: 0;
}
#wrapper {
width: 100%;
}
#header {
width: 100%;
background-color: #EDEDED;
height: 40px;
}
#header #logo {
font-weight: bold;
font-family: Helvetica;
font-size: 0.9em;
padding: 10px 10px;
float: left;
}
#header #menu {
width: 220px;
margin: 0 auto;
border: 1px solid grey;
border-radius: 3px;
height: 27px;
position: relative;
top: 5px;
padding-left: 0px;
padding-right: 0px;
}
#header ul li {
float: left;
list-style-type: none;
padding: 5px 10px;
border-right: 1px solid grey;
font-size: 1em;
}
#header ul li:last-child {
border-right: none;
}
#run_btn {
float: right;
padding: 5px 10px 0 0;
}
#run_btn #run {
font-size: 120%;
}
.clear {
clear: both
}
link
It does not work in the responsive layout . so the solution would be wither use the #media-queries or u can use the bootstrap grid layout , where u can put header as a row and giving the 3 columns of size 4 i.e 'col-md-4',
this will keep the code intact with the window resize.
I have a website I'm designing and I ran across a problem with resizing.
Here is my website when maximized in Chromium 28.0:
and you can see the grey menu bar reaches all the way across.
However, when I go to resize the window:
The code for that div (#header) is:
#header {
background-color: #dcdcdc;
border-bottom: 1px solid #e6e6e6;
padding: 27px 0;
}
so there is no set width.
What's going on?
EDIT: 11/1/2013
Here's my HTML for the header:
<div id="header">
<div>
<div class="logo">
Thumbnails
</div>
<ul id="navigation">
<li class="active">
Home
</li>
<li>
Features
</li>
<li>
News
</li>
<li>
About
</li>
<li>
Contact
</li>
</ul>
</div>
</div>
EDIT: 11/1/2013 Firefox Screenshot:
I added a screenshot from Firefox and the problem affects the footer as well (happens in Chromium as well)
After simplifying your html + css, I came up with a solution that appears to work as intended. I believe the problem was the way you had setup the padding + margin.
The HTML:
<div class="page-container">
<header class="top-bar">
<div class="inner">
<h2 class="logo">Logo</h2>
<ul class="main-nav">
<li class="active">Home</li>
<li>Features</li>
<li>News</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</header>
<section class="main-content"></section>
<footer class="bottom-bar">
<div class="inner">
<span class="copyright">Copyright info here.</span>
<span class="contact">Contact info here.</span>
</div>
</footer>
</div>
</body>
The CSS:
body {
margin: 0;
padding: 0;
}
.page-container {
margin: 0;
padding: 0;
}
/* ===============================================
/* ====== HEADER + NAVIGATION STYLES
/* ============================================ */
.top-bar {
background: #EEE;
height: 100px;
text-align: center;
}
.inner {
background: #DDD;
display: block;
height: 100px;
margin: 0 auto;
width: 920px;
}
.logo {
background: #CCC;
display: block;
float: left;
font-size: 16px;
height: 30px;
line-height: 30px;
margin: 0;
padding: 35px 0;
width: 120px;
}
.main-nav {
display: block;
float: left;
height: 30px;
line-height: 30px;
margin: 0;
padding: 35px 0;
}
.main-nav li {
display: block;
float: left;
width: 160px;
}
.main-nav li a {
color: #999;
font-size: 14px;
text-decoration: none;
}
.main-nav li.active a,
.main-nav li a:hover {
color: #F99600;
}
/* ===============================================
/* ====== MAIN CONTENT PLACEHOLDER STYLES
/* ============================================ */
.main-content {
background: #F6F6F6;
height: auto;
margin: 0 auto;
min-height: 500px;
width: 920px;
}
/* ===============================================
/* ====== FOOTER ELEMENT STYLES
/* ============================================ */
.bottom-bar {
background: #EEE;
height: 100px;
}
.bottom-bar .copyright,
.bottom-bar .contact {
display: block;
font-size: 12px;
height: 30px;
line-height: 30px;
margin: 0;
padding: 35px;
}
.copyright { float: left; }
.contact { float: right; }
You can check out the working code here: http://jsfiddle.net/onestepcreative/X8QbD/
I have 5 divs in two wrapper divs and when I am assigning the float left attribute to the 5 dips they are gaining a 'top-margin' of 5, as in they have a space between the top of the wrapper div and them. Here is My HTML and CSS
HTML:
<div class="headerMenuWrapper">
<div class="menuOuterWrapper">
<div class="menuInnerWrapper" id="menuWrapper">
<div class="menuItem">Home</div>
<div class="menuItem">About Us</div>
<div class="menuItem">Products</div>
<div class="menuItem">FAQ</div>
<div class="menuItem">Contact Us</div>
</div>
</div>
</div>
CSS:
.menuOuterWrapper{
margin: auto;
margin-top: 0;
width: 95%;
height: 100%;
}
.menuInnerWrapper {
margin: auto;
margin-top: 0;
width: 90%;
height: 100%;
background-color: #327CF1;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
box-shadow: 1px 1px 5px #000000;
}
.menuItem {
height: 100%;
text-align: center;
border-right: 1px solid #051625;
float: left;
}
.headerMenuWrapper {
margin: auto;
width: 95%;
height: 50%;
}
Is this what you are looking for?
You have a lot going on in your markup that shouldn't be.
I simplified everything for you by using:
nav
ul
li
Instead of floats and margins, I used:
display: table
display: table-cell
text-align: center
HTML
<nav id="menu">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Products</li>
<li>FAQ</li>
<li>Contact Us</li>
</ul>
</nav>
CSS
* {
margin: 0;
padding: 0;
border: none;
}
#menu {
margin: 0 auto;
text-align: center;
}
#menu > ul {
display: table;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
box-shadow: 1px 1px 5px #000000;
background: #327CF1;
width: 100%;
}
#menu ul > li {
display: table-cell;
text-align: center;
border-right: 1px solid white;
color: white;
}
#menu > ul > li:last-child {
border: none;
}
use Resetting Browser-Style Defaults for Elements
shorthand for you
{
margin: 0px;
padding: 0px;
}
margin: auto tells to browser automatically calculate margin
example of reset styles here http://meyerweb.com/eric/thoughts/2007/04/12/reset-styles/