{"id":338493,"date":"2021-04-16T07:31:41","date_gmt":"2021-04-16T14:31:41","guid":{"rendered":"https:\/\/css-tricks.com\/?p=338493"},"modified":"2021-04-16T07:31:43","modified_gmt":"2021-04-16T14:31:43","slug":"not-your-typical-horizontal-rules","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/not-your-typical-horizontal-rules\/","title":{"rendered":"Not Your Typical Horizontal Rules"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The default browser style for <code>&lt;hr&gt;<\/code> is <em>so weird<\/em>. It&#8217;s basically:<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">border-style: inset;\nborder-width: 1px;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The default <code>border-color<\/code> is <code>black<\/code>, but the border doesn&#8217;t actually <em>look<\/em> black, because the inset border &#8220;adds a split tone to the line that makes the element appear slightly depressed.&#8221;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">If I kick up the <code>border-width<\/code> to <code>40px<\/code> you can see it more clearly:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1756\" height=\"312\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=1756%2C312&#038;ssl=1\" alt=\"\" class=\"wp-image-338494\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?w=1756&amp;ssl=1 1756w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=300%2C53&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=1024%2C182&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=768%2C136&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=1536%2C273&amp;ssl=1 1536w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-15-at-2.19.47-PM.png?resize=1000%2C178&amp;ssl=1 1000w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I often reset an <code>&lt;hr&gt;<\/code> to be &#8220;just a line&#8221; and it always gets me because I&#8217;ll try something, like <code>height: 1px<\/code> with a background at first, but that&#8217;s not right. The easier way to clear it is to turn off all the borders then only use <code>border-top<\/code> or <code>border-bottom<\/code>. Or, turn off all the borders, set a height, and use a background. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Annnyway&#8230;<\/em> Sara has some of the nicest horizontal rules in town on the current design of her site, and <a href=\"https:\/\/www.sarasoueidan.com\/blog\/horizontal-rules\/\" rel=\"noopener\">she&#8217;s written it all up.<\/a> Guess what? They aren&#8217;t even <code>&lt;hr&gt;<\/code> elements! It turns out the only styling hook you have is CSS, which wasn&#8217;t as adaptive as Sara needed, so she ended up with a <code>&lt;div role=\"separator\"&gt;<\/code> (<abbr title=\"today I learned\">TIL<\/abbr>!) and inline SVG.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p>The best way to get the full flexibility of an SVG is by inlining it. But the&nbsp;<code>&lt;hr&gt;<\/code>&nbsp;element is content-less \u2014 it has no opening and closing tags within which you can place other elements.<\/p><p>The only way to work around the limitations of&nbsp;<code>&lt;hr&gt;<\/code>&nbsp;while preserving semantics for screen reader users is to use a&nbsp;<code>div<\/code>&nbsp;and provide the semantics of an&nbsp;<code>hr<\/code>&nbsp;using ARIA.<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default browser style for &lt;hr&gt; is so weird. It&#8217;s basically: The default border-color is black, but the border doesn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":338502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[17],"tags":[18931],"class_list":["post-338493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-links","tag-horizontal-rule"],"acf":{"link_source":"","link_url":"","link_icon":null,"show_toc":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/sara-soueidan-hr.jpg?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":344815,"url":"https:\/\/css-tricks.com\/css-logical-properties-and-values\/","url_meta":{"origin":338493,"position":0},"title":"CSS Logical Properties and Values","author":"Ollie Williams","date":"July 27, 2021","format":false,"excerpt":"Now that cross-browser support is at a tipping point, it's a good time to take a look at logical properties and values. If you're creating a website in multiple languages, logical properties and values are incredibly useful. Even if you're not, there are still some convenient new shorthands it's worth\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/s_23DCC53F37C675A56273FC1D596017BBDCB5DB765FF03E9E64CEC128CB81E439_1624787344817_blockandinline.png?fit=1200%2C454&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/s_23DCC53F37C675A56273FC1D596017BBDCB5DB765FF03E9E64CEC128CB81E439_1624787344817_blockandinline.png?fit=1200%2C454&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/s_23DCC53F37C675A56273FC1D596017BBDCB5DB765FF03E9E64CEC128CB81E439_1624787344817_blockandinline.png?fit=1200%2C454&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/s_23DCC53F37C675A56273FC1D596017BBDCB5DB765FF03E9E64CEC128CB81E439_1624787344817_blockandinline.png?fit=1200%2C454&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/s_23DCC53F37C675A56273FC1D596017BBDCB5DB765FF03E9E64CEC128CB81E439_1624787344817_blockandinline.png?fit=1200%2C454&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":558,"url":"https:\/\/css-tricks.com\/body-border\/","url_meta":{"origin":338493,"position":1},"title":"Creating a Body Border","author":"Chris Coyier","date":"May 25, 2011","format":false,"excerpt":"A border that goes all the way around the browser window and stays there when you scroll. In this article we cover a few different techniques to get it done, from the deepest browser support to the most progressive.","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2008\/02\/bodyborder-manydevices.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2008\/02\/bodyborder-manydevices.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2008\/02\/bodyborder-manydevices.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":275378,"url":"https:\/\/css-tricks.com\/css-logical-properties\/","url_meta":{"origin":338493,"position":2},"title":"CSS Logical Properties","author":"Chris Coyier","date":"August 21, 2018","format":false,"excerpt":"A property like margin-left seems fairly logical, but as Manuel Rego Casasnovas says: Imagine that you have some right-to-left (RTL) content on your website your left might be probably the physical right, so if you are usually setting margin-left: 100px for some elements, you might want to replace that with\u2026","rel":"","context":"In &quot;Links&quot;","block_context":{"text":"Links","link":"https:\/\/css-tricks.com\/category\/links\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/08\/logical-css-properties.gif?fit=800%2C400&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/08\/logical-css-properties.gif?fit=800%2C400&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/08\/logical-css-properties.gif?fit=800%2C400&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/08\/logical-css-properties.gif?fit=800%2C400&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":8023,"url":"https:\/\/css-tricks.com\/three-sided-border\/","url_meta":{"origin":338493,"position":3},"title":"Three-Sided Border","author":"Chris Coyier","date":"December 6, 2010","format":false,"excerpt":"There are many ways to skin a cat. Also, there are many ways to accomplish the same thing in CSS. The three sided border is one of those things, so we'll look at four different examples that all do it. I would think this kind of thing is a bit\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21471,"url":"https:\/\/css-tricks.com\/3d-inset-parallax-effect\/","url_meta":{"origin":338493,"position":4},"title":"3D Inset Parallax Effect","author":"Josh Bader","date":"May 4, 2013","format":false,"excerpt":"The following is a guest post by Joshua Bader. Joshua noticed that certain 3D effects on the web could benefit from adjusting perspective as the web page is scrolled. I'll let him explain. People love to make flat things appear as if they're three-dimensional. There are two ways to pull\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":237034,"url":"https:\/\/css-tricks.com\/the-backgound-clip-property-and-use-cases\/","url_meta":{"origin":338493,"position":5},"title":"The `background-clip` Property and its Use Cases","author":"Ana Tudor","date":"February 5, 2016","format":false,"excerpt":"background-clip is one of those properties I've known about for years, but rarely used. Maybe just a couple of times as part of a solution to a Stack Overflow question. Until last year, when I started creating my huge collection of sliders. Some of the designs I chose to reproduce\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=338493"}],"version-history":[{"count":3,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338493\/revisions"}],"predecessor-version":[{"id":338517,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338493\/revisions\/338517"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/338502"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=338493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=338493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=338493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}