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 |
Interesting Hover Animation | 2,686 Kb |
Globule Bleu Jobs Page Anchor Rollover Effect | 2,533 Kb |
Flyknife Comics | 2,934 Kb |
Psychedelic Slice | 2,681 Kb |
The power of transform for centering - INTERACTIVE | 2,439 Kb |
Zoomy Anchor Thing | 2,680 Kb |
Student Charter Demo for City University | 5,837 Kb |
Stupid RTL Demo | 3,075 Kb |
Slip-n-slide Modal | 3,316 Kb |
Infinite Square | 2,937 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 |
Bezier Animation with straight paths | Rhernando | 2,087 Kb |
The CodePen Logo | Kindofone | 4,259 Kb |
TigerWoods Freecodecamp Page | Baileytj | 2,869 Kb |
A Pen by Bryan Rojas | Bryanrojas | 1,873 Kb |
A Pen by Dalton Liu | Liudalton | 12,437 Kb |
Flying Bee | Pwsm50 | 3,711 Kb |
IbrahimJabbari-Effect21 | Ibrahimjabbari | 1,882 Kb |
Obligatory CSS3 UI Nav | Romandiaz | 9,017 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
Acorrdian 2016 | Milanodituti | 3,720 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!