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,408 |
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 |
Stupid RTL Demo | 3,075 Kb |
Cutaway Indicator | 2,435 Kb |
The power of transform for centering | 3,747 Kb |
Simple CSS Checkbox | 3,244 Kb |
Student Charter Demo for City University | 5,837 Kb |
Clock Face Idea | 3,196 Kb |
Persistent Light Source Transform | 2,785 Kb |
Interaction Jazz | 11,103 Kb |
Slip-n-slide Modal | 3,316 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 |
Easing | GreenSock | 2,043 Kb |
Placeholder support for contentEditable elements, without JavaScript | Flesler | 1,863 Kb |
Playing with FlexBox | _Billy_Brown | 3,162 Kb |
Content Changer | Cliffpyles | 4,538 Kb |
CSS Infinite 360 | APinix | 5,564 Kb |
Multi-step GSAP animation | Acacheung | 2,668 Kb |
Heartbeat | Apetrov | 2,079 Kb |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Responsive Pricing Table | Jeremycaris | 2,690 Kb |
Right Click Menu | Anodpixels | 2,252 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!