The Importance of Proper Navigational CSS
How do I make an the importance of proper navigational css?
A simple demo to show why not setting display: block; on navigational anchor tags is poor UX.In the first demo, the anchor tag is display: inline-block; and the link is only clickable when the text is hovered.. What is a the importance of proper navigational css? How do you make a the importance of proper navigational css? This script and codes were developed by Chris Burnell on 16 September 2022, Friday.
The Importance of Proper Navigational CSS - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>The Importance of Proper Navigational CSS</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { color: #333; font: 400 13px/1.618 "Helvetica Neue", Arial, serif; padding-bottom: 30px;
}
h1, p, ul, a { text-align: center; margin: 0 auto;
}
h1 { margin: 30px 0 10px; clear: both; font-size: 22px; font-weight: bold;
}
p { width: 620px; text-align: justify; clear: both;
}
ul { width: 620px; height: 30px; margin-bottom: 15px; clear: both;
}
li { background: rgba(0,0,0,.1); width: 200px; float: left;
}
li:not(:last-child) { margin-right: 10px;
}
a { color: #444; font: 700 16px/40px "Helvetica Neue", Arial, serif; text-decoration: none; text-transform: uppercase;
}
a:hover { background: #444; color: #f9f9f9;
}
.second-demo li a { width: 100%; display: block;
}
.third-demo li { width: 170px; padding: 0 15px;
}
.third-demo li a { display: block; width: 100%;
}
.fourth-demo li a { width: auto; padding: 0 15px; display: block;
}
code { font-family: Monaco, 'Courier New', monospace; font-size: .8125em;
}
em { font-style: italic; }
.correct { color: #2ec740; }
.incorrect { color: #bd1717; } </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1 class="incorrect">× No styling on anchor</h1>
<ul class="first-demo"> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li>
</ul>
<p>Anchor tags have no <code>display</code> declaration here.</p>
<p>Height of the list items is dictated by the line-height of the anchors throughout.</p>
<h1 class="correct">√ a { display: block; width: 100%; }</h1>
<ul class="second-demo"> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li>
</ul>
<p>Anchor tags are declared as <code>display: block;</code> <code>width: 100%;</code> here.</p>
<p>The user can now click anywhere within the list item and it will register a click on the anchor as well because each anchor sits on top of/above its parent list item.</p>
<h1 class="incorrect">× li { padding: 0 15px; } a { display: block; width: auto; }</h1>
<ul class="third-demo"> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li>
</ul>
<p>List items have <code>padding: 15px;</code> here. Because the anchors are childen of the list items, they can only expand as big as the <code>width</code> constraints of the parent list items—170px.</p>
<h1 class="correct">√ a { padding: 0 15px; display: block; width: auto; }</h1>
<ul class="fourth-demo"> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li> <li><a href="#">Item One</a></li>
</ul>
<p>Anchor tags are declared as <code>display: block;</code> & <code>width: auto;</code> and <code>padding: 0 15px;</code> here.</p>
<p>Clicking anywhere within the list item works here as well, as long as things like <code>padding</code> or <code>border</code> are set on the anchor, not the parent list item.</p>
</body>
</html>
The Importance of Proper Navigational CSS - Script Codes CSS Codes
body { color: #333; font: 400 13px/1.618 "Helvetica Neue", Arial, serif; padding-bottom: 30px;
}
h1, p, ul, a { text-align: center; margin: 0 auto;
}
h1 { margin: 30px 0 10px; clear: both; font-size: 22px; font-weight: bold;
}
p { width: 620px; text-align: justify; clear: both;
}
ul { width: 620px; height: 30px; margin-bottom: 15px; clear: both;
}
li { background: rgba(0,0,0,.1); width: 200px; float: left;
}
li:not(:last-child) { margin-right: 10px;
}
a { color: #444; font: 700 16px/40px "Helvetica Neue", Arial, serif; text-decoration: none; text-transform: uppercase;
}
a:hover { background: #444; color: #f9f9f9;
}
.second-demo li a { width: 100%; display: block;
}
.third-demo li { width: 170px; padding: 0 15px;
}
.third-demo li a { display: block; width: 100%;
}
.fourth-demo li a { width: auto; padding: 0 15px; display: block;
}
code { font-family: Monaco, 'Courier New', monospace; font-size: .8125em;
}
em { font-style: italic; }
.correct { color: #2ec740; }
.incorrect { color: #bd1717; }

Developer | Chris Burnell |
Username | chrisburnell |
Uploaded | September 16, 2022 |
Rating | 3 |
Size | 3,165 Kb |
Views | 34,391 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Globule Bleu Jobs Page Anchor Rollover Effect | 2,533 Kb |
Cutaway Indicator | 2,435 Kb |
Interaction Jazz | 11,103 Kb |
Infinite Square | 2,937 Kb |
Message Types | 2,987 Kb |
Category Hover Demo | 3,469 Kb |
The power of transform for centering | 3,747 Kb |
Interesting Hover Animation | 2,686 Kb |
Modal Container without JS | 3,272 Kb |
Flyknife Comics | 2,934 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Another brick in the wall | Fivera | 1,955 Kb |
Day 1 - Portfolio | Chpecson | 3,532 Kb |
SVG Playground | Roygwells | 1,834 Kb |
Loading... | Adamjacob | 2,384 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
Countdown with Rings | Ewganoel | 2,490 Kb |
Resizable SASS Icons | Marianarlt | 7,611 Kb |
CSS3 Form Page Design | Rssatnam | 3,613 Kb |
Pericles mi loro... | Judag | 4,125 Kb |
Scroll to view if element partially out of view port height | ChrisMaki | 2,104 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!