How to make <hr> same width as the horizontal menu? - css
I'm trying to style the menu with to have the horizontal line above it the same width, like on this Blue Note website. I can't seem to get it to scale right, I found this question is similar but it did not help me. I've tried a bunch of things and could really appreciate some help, I'm using WordPress with the Blaskan theme. Here is the Fiddle and the related HTML and CSS:
<nav id="NAV_1">
<button id="BUTTON_2">
Menu
</button>
<div id="DIV_3">
<h6 id="H6_4">
READING JAZZ - LISTENING TO LITERATURE
</h6><hr id="HR_5" />
</div>
<div id="DIV_6">
<ul id="UL_7">
<li id="LI_8">
News
</li>
<li id="LI_10">
Home
</li>
<li id="LI_12">
About
</li>
<li id="LI_14">
Contact
</li>
<li id="LI_16">
Jazz
</li>
<li id="LI_18">
Literature
</li>
<li id="LI_20">
Test
</li>
<li id="LI_22">
New
</li>
</ul>
</div>
#NAV_1 {
box-sizing: border-box;
color: rgb(137, 137, 137);
height: 227.538px;
overflow-wrap: break-word;
text-align: justify;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 750px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 375px 113.762px;
transform-origin: 375px 113.762px;
caret-color: rgb(137, 137, 137);
border: 0px none rgb(137, 137, 137);
font: normal normal 400 normal 14px / 25.9px Verdana;
margin: 0px 101.8px;
outline: rgb(137, 137, 137) none 0px;
padding: 0px 15px;
}/*#NAV_1*/
#NAV_1:after {
box-sizing: border-box;
clear: both;
color: rgb(137, 137, 137);
content: '"' '"';
display: table;
height: 0px;
overflow-wrap: break-word;
text-align: justify;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 0px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 0px 0px;
transform-origin: 0px 0px;
caret-color: rgb(137, 137, 137);
border: 0px none rgb(137, 137, 137);
font: normal normal 400 normal 14px / 25.9px Verdana;
outline: rgb(137, 137, 137) none 0px;
}/*#NAV_1:after*/
#NAV_1:before {
box-sizing: border-box;
color: rgb(137, 137, 137);
content: '"' '"';
display: table;
height: 0px;
overflow-wrap: break-word;
text-align: justify;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 0px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 0px 0px;
transform-origin: 0px 0px;
caret-color: rgb(137, 137, 137);
border: 0px none rgb(137, 137, 137);
font: normal normal 400 normal 14px / 25.9px Verdana;
outline: rgb(137, 137, 137) none 0px;
}/*#NAV_1:before*/
#BUTTON_2 {
color: rgba(0, 0, 0, 0.8);
cursor: pointer;
display: none;
height: auto;
overflow-wrap: break-word;
text-decoration: none solid rgba(0, 0, 0, 0.8);
text-size-adjust: 100%;
width: auto;
word-wrap: break-word;
column-rule-color: rgba(0, 0, 0, 0.8);
perspective-origin: 50% 50%;
transform-origin: 50% 50%;
caret-color: rgba(0, 0, 0, 0.8);
background: rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgba(0, 0, 0, 0.8);
font: normal normal 400 normal 20px / 20px "Source Sans Pro", sans-serif;
margin: 0px auto;
outline: rgba(0, 0, 0, 0.8) none 0px;
padding: 20px 0px;
}/*#BUTTON_2*/
#BUTTON_2:after {
box-sizing: border-box;
color: rgba(0, 0, 0, 0.8);
content: '""';
cursor: pointer;
overflow-wrap: break-word;
text-decoration: none solid rgba(0, 0, 0, 0.8);
text-size-adjust: 100%;
word-wrap: break-word;
column-rule-color: rgba(0, 0, 0, 0.8);
caret-color: rgba(0, 0, 0, 0.8);
border: 0px none rgba(0, 0, 0, 0.8);
font: normal normal 400 normal 20px / 20px FontAwesome;
outline: rgba(0, 0, 0, 0.8) none 0px;
padding: 0px 0px 0px 20px;
}/*#BUTTON_2:after*/
#DIV_3 {
box-sizing: border-box;
color: rgb(137, 137, 137);
height: 28.4px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 720px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 360px 14.2px;
transform-origin: 360px 14.2px;
caret-color: rgb(137, 137, 137);
border: 0px none rgb(137, 137, 137);
font: normal normal 400 normal 14px / 25.9px Verdana;
outline: rgb(137, 137, 137) none 0px;
}/*#DIV_3*/
#H6_4 {
box-sizing: border-box;
clear: both;
color: rgb(51, 51, 51);
height: 22.4px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(51, 51, 51);
text-size-adjust: 100%;
width: 720px;
word-wrap: break-word;
column-rule-color: rgb(51, 51, 51);
perspective-origin: 360px 11.2px;
transform-origin: 360px 11.2px;
caret-color: rgb(51, 51, 51);
border: 0px none rgb(51, 51, 51);
font: normal normal 400 normal 18px / 22.5px "Droid Serif", serif;
margin: 41.94px 0px -4px;
outline: rgb(51, 51, 51) none 0px;
}/*#H6_4*/
#HR_5 {
color: rgb(137, 137, 137);
height: 3px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 720px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 279.2px 0.5px;
transform-origin: 279.2px 0.5px;
caret-color: rgb(137, 137, 137);
background: rgb(25, 23, 98) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(0, 0, 0);
font: normal normal 400 normal 13px / 16.003px "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 7px 0px 16px;
outline: rgb(137, 137, 137) none 0px;
}/*#HR_5*/
#DIV_6 {
box-sizing: border-box;
color: rgb(137, 137, 137);
height: 171.2px;
overflow-wrap: break-word;
text-align: justify;
text-decoration: none solid rgb(137, 137, 137);
text-size-adjust: 100%;
width: 720px;
word-wrap: break-word;
column-rule-color: rgb(137, 137, 137);
perspective-origin: 360px 85.6px;
transform-origin: 360px 85.6px;
caret-color: rgb(137, 137, 137);
border: 0px none rgb(137, 137, 137);
font: normal normal 400 normal 14px / 25.9px Verdana;
margin: -30px 0px 0px;
outline: rgb(137, 137, 137) none 0px;
}/*#DIV_6*/
#UL_7 {
box-sizing: border-box;
color: rgb(25, 23, 98);
height: 171.2px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 720px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 360px 85.6px;
transform-origin: 360px 85.6px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
margin: 0px;
outline: rgb(25, 23, 98) none 0px;
padding: 0px;
}/*#UL_7*/
#LI_8, #LI_10 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 87px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 43.5px 42.8px;
transform-origin: 43.5px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_8, #LI_10*/
#A_9, #A_11 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 42px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 21px 42.8px;
transform-origin: 21px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_9, #A_11*/
#LI_12 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 93.2375px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 46.6125px 42.8px;
transform-origin: 46.6125px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_12*/
#A_13 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 48.2375px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 24.1125px 42.8px;
transform-origin: 24.1125px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_13*/
#LI_14 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 111.625px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 55.8125px 42.8px;
transform-origin: 55.8125px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_14*/
#A_15 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 66.625px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 33.3125px 42.8px;
transform-origin: 33.3125px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_15*/
#LI_16 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 78.45px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 39.225px 42.8px;
transform-origin: 39.225px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_16*/
#A_17 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 33.45px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 16.725px 42.8px;
transform-origin: 16.725px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_17*/
#LI_18 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 131.087px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 65.5375px 42.8px;
transform-origin: 65.5375px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_18*/
#A_19 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 86.0875px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 43.0375px 42.8px;
transform-origin: 43.0375px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_19*/
#LI_20 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 80.7875px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 40.3875px 42.8px;
transform-origin: 40.3875px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 0px 45px 0px 0px;
}/*#LI_20*/
#A_21 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 35.7875px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 17.8875px 42.8px;
transform-origin: 17.8875px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_21*/
#LI_22 {
bottom: 0px;
box-sizing: border-box;
color: rgb(25, 23, 98);
display: inline-block;
height: 85.6px;
left: 0px;
overflow-wrap: break-word;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
top: 0px;
width: 32.6625px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 16.325px 42.8px;
transform-origin: 16.325px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
}/*#LI_22*/
#A_23 {
box-sizing: border-box;
color: rgb(25, 23, 98);
display: block;
height: 85.6px;
overflow-wrap: break-word;
text-align: center;
text-decoration: none solid rgb(25, 23, 98);
text-size-adjust: 100%;
text-transform: uppercase;
width: 32.6625px;
word-wrap: break-word;
column-rule-color: rgb(25, 23, 98);
perspective-origin: 16.325px 42.8px;
transform-origin: 16.325px 42.8px;
caret-color: rgb(25, 23, 98);
border: 0px none rgb(25, 23, 98);
font: normal normal 400 normal 14px / 25.9px Helvetica;
list-style: none outside none;
outline: rgb(25, 23, 98) none 0px;
padding: 30px 0px;
}/*#A_23*/
Instead of using HR element, add a border-top CSS property to your menu
(either on LI element like example below, or on UL element)
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
border-top: 2px solid red;
float: left;
padding: 10px 5px;
background:#eee;
}
<div>
<ul>
<li>menu 1</li>
<li>menu 2</li>
<li>menu 3</li>
<li>menu 4</li>
<li>menu 5</li>
<li>menu 6</li>
</ul>
</div>
Related
For what reasons would an absolute div position itself in relation to a static parent? [duplicate]
This question already has answers here: 'transform3d' not working with position: fixed children (10 answers) Closed 3 years ago. I have an absolutely positioned Bootstrap 3 dropdown mega menu that is offsetting it's position from a static parent div. I want it to position itself to a relative parent that's further up the DOM. I've tried using !important rules to set every parent (but the correct one) to position: static - but this won't work. This doesn't have the correct visuals, but this CodePen demonstrates the issue: https://codepen.io/anon/pen/mNEyVR .site-header { box-sizing: border-box; color: rgb(51, 51, 51); display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; height: 150.15px; line-height: 22.85px; position: relative; -moz-osx-font-smoothing: grayscale; } .site-header__main { border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; height: 85px; line-height: 22.85px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; -moz-osx-font-smoothing: grayscale; } .site-header__main-inner { background-attachment: scroll; background-clip: border-box; background-color: rgb(255, 255, 255); background-image: none; background-origin: padding-box; background-position: 0% 0%; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; box-sizing: border-box; color: rgb(51, 51, 51); display: flex; flex-direction: row; flex-wrap: nowrap; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; height: 68px; line-height: 22.85px; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 16px; padding-bottom: 0px; padding-left: 40px; padding-right: 40px; padding-top: 0px; position: relative; z-index: 999; -moz-box-direction: normal; -moz-box-orient: horizontal; -moz-osx-font-smoothing: grayscale; } .site-nav { background-attachment: scroll; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-image: none; background-origin: padding-box; background-position: 0% 0%; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-top-color: rgb(51, 51, 51); border-top-style: none; border-top-width: 0px; box-sizing: border-box; color: rgb(51, 51, 51); flex-basis: 0px; flex-grow: 1; flex-shrink: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; height: 68px; left: 0px; line-height: 22.85px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow: visible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; top: 0px; transform: matrix(1, 0, 0, 1, 0, 0); transition-delay: 0s, 0s, 0s; transition-duration: 0.36s, 0.36s, 0.36s; transition-property: transform, visibility, transform; transition-timing-function: ease, ease, ease; visibility: visible; width: 1015px; z-index: auto; -moz-box-flex: 1; -moz-osx-font-smoothing: grayscale; } nav { box-sizing: border-box; color: rgb(51, 51, 51); display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.85px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; visibility: visible; -moz-osx-font-smoothing: grayscale; } ul { box-sizing: border-box; color: rgb(51, 51, 51); display: flex; float: left; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; justify-content: flex-end; line-height: 22.85px; list-style-image: none; list-style-position: outside; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; visibility: visible; width: 1015px; -moz-box-pack: end; -moz-osx-font-smoothing: grayscale; } li.open { box-sizing: border-box; color: rgb(51, 51, 51); display: block; float: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.85px; list-style-image: none; list-style-position: outside; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; visibility: visible; -moz-osx-font-smoothing: grayscale; } .dropdown-menu { background-attachment: scroll; background-clip: border-box; background-color: rgb(236, 236, 236); background-image: none; background-origin: padding-box; background-position: 0% 0%; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-bottom-color: rgb(214, 214, 214); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-bottom-style: solid; border-bottom-width: 1px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(51, 51, 51); border-left-style: none; border-left-width: 0px; border-right-color: rgb(51, 51, 51); border-right-style: none; border-right-width: 0px; border-top-color: rgb(51, 51, 51); border-top-left-radius: 0px; border-top-right-radius: 0px; border-top-style: none; border-top-width: 0px; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px; box-sizing: border-box; color: rgb(51, 51, 51); display: none; float: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; left: 0px; line-height: 22.85px; list-style-image: none; list-style-position: outside; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 160px; padding-bottom: 32px; padding-left: 0px; padding-right: 0px; padding-top: 16px; position: absolute; text-align: left; top: 100%; visibility: visible; width: 100%; z-index: 1000; -moz-osx-font-smoothing: grayscale; } li.open .dropdown-menu { background-attachment: scroll; background-clip: border-box; background-color: rgb(236, 236, 236); background-image: none; background-origin: padding-box; background-position: 0% 0%; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-bottom-color: rgb(214, 214, 214); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-bottom-style: solid; border-bottom-width: 1px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(51, 51, 51); border-left-style: none; border-left-width: 0px; border-right-color: rgb(51, 51, 51); border-right-style: none; border-right-width: 0px; border-top-color: rgb(51, 51, 51); border-top-left-radius: 0px; border-top-right-radius: 0px; border-top-style: none; border-top-width: 0px; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px; box-sizing: border-box; color: rgb(51, 51, 51); display: block; float: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; left: 0px; line-height: 22.85px; list-style-image: none; list-style-position: outside; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 160px; padding-bottom: 32px; padding-left: 0px; padding-right: 0px; padding-top: 16px; position: absolute; text-align: left; top: 68px; visibility: visible; width: 1015px; z-index: 1000; -moz-osx-font-smoothing: grayscale; } <header class="site-header"> <div class="site-header__main"> <div class="site-header__main-inner"> <div class="site-nav"> <nav> <ul> <li class="open"> Link 1 <div class="dropdown-menu"> <p>content 1</p> </div> </li> <li> Link 2 <div class="dropdown-menu"> <p>content 2</p> </div> </li> <li> Link 3 <div class="dropdown-menu"> <p>content 3</p> </div> </li> </ul> </nav> </div> </div> </div> </header> If you Inspect the first .dropdown-menu in Firefox, you'll see in the Layout tab that the menu is positioning itself in relation to a static parent. It should be positioning in relation to a further-up parent that actually has its position set to relative.
I tried reducing my code the make it easier to parse and I solved my own problem. The div .site-nav was incorrectly acting a the relative parent to my absolute div. For some reason, this was caused by this CSS: transform: matrix(1, 0, 0, 1, 0, 0); I've never used the matrix code before so I don't know what this does. It wasn't even in my code. My code was transform: translateY(0) and apparently my gulp file was adding the goofy matrix content. I changed the transform to transform: none and the problem was fixed!
Horizontal scrollbar not selectable (on Linux?)
I have a Hugo template I am attempting to use. However, certain divs attempt to scroll horizontally, but on Chrome or Firefox on Linux I cannot manipulate the horizontal scroll bar. The horizontally scroll bar is present and looks normal, but I cannot move the slider. Why is horizontal scrolling not working correctly on some browsers/OSes? Interestingly, this appears to not be an issue on Chrome or FF when running Mac, which leads me to believe it's some kind of bizarre platform issue. HTML: <!DOCTYPE html> <html> <head> <title></title> </head> <body> <article id="ARTICLE_1"> <div id="DIV_2"> <h1 id="H1_3">Getting started <a href="#" id="A_4" title= "Permanent link">#</a></h1> <h2 id="H2_5">Installation<a href="#installation" id="A_6" title= "Permanent link">#</a></h2> <h3 id="H3_7">Installing Hugo<a href="#installing-hugo" id="A_8" title= "Permanent link">#</a></h3> <p id="P_9">Hugo itself is just a single binary without dependencies on expensive runtimes like Ruby, Python or PHP and without dependencies on any databases. You just need to download the <a href= "https://github.com/spf13/hugo/releases" id="A_10">latest version</a>. For more information read the official <a href= "http://gohugo.io/overview/installing/" id="A_11">installation guides</a>.</p> <p id="P_12">Let’s make sure Hugo is set up as expected. You should see a similar version number in your terminal:</p> <pre id="PRE_13"><code class="language-sh hljs bash" id= "CODE_14">hugo version <span class="hljs-comment" id= "SPAN_15"># Hugo Static Site Generator v0.15 BuildDate: 2016-01-03T12:47:47+01:00</span> </code> </pre> <h3 id="H3_16">Installing Material<a href="#installing-material" id="A_17" title="Permanent link">#</a></h3> <p id="P_18">Next, assuming you have Hugo up and running the <code id= "CODE_19">hugo-material-docs</code> theme can be installed with <code id= "CODE_20">git</code> :</p> <pre id="PRE_21"><code class="language-sh hljs bash" id= "CODE_22"><span class="hljs-comment" id= "SPAN_23"># create a new Hugo website</span> hugo new site my-awesome-docs <span class="hljs-comment" id= "SPAN_24"># move into the themes folder of your website</span> <span class="hljs-built_in" id="SPAN_25">cd</span> my-awesome-docs/themes/ <span class="hljs-comment" id="SPAN_26"># download the theme</span> git <span class="hljs-built_in" id= "SPAN_27">clone</span> git#github.com:digitalcraftsman/hugo-material-docs.git long line aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb </code> </pre> <h2 id="H2_28">Setup<a href="#setup" id="A_29" title= "Permanent link">#</a></h2> <p id="P_30">Next, take a look in the <code id="CODE_31">exampleSite</code> folder at <code id="CODE_32">themes/hugo-material-docs/</code> . This directory contains an example config file and the content that you are currently reading. It serves as an example setup for your documentation.</p> <p id="P_33">Copy at least the <code id="CODE_34">config.toml</code> in the root directory of your website. Overwrite the existing config file if necessary.</p> <p id="P_35">Hugo includes a development server, so you can view your changes as you go - very handy. Spin it up with the following command:</p> <pre id="PRE_36"><code class="language-sh hljs bash" id= "CODE_37">hugo server </code> </pre> <p id="P_38">Now you can go to <a href="http://localhost:1313" id= "A_39">localhost:1313</a> and the Material theme should be visible. You can now start writing your documentation, or read on and customize the theme through some options.</p> <aside id="ASIDE_40"> © 2017 Released under the MIT license – Documentation built with <a href= "https://www.gohugo.io" id="A_41">Hugo</a> using the <a href= "http://github.com/digitalcraftsman/hugo-material-docs" id= "A_42">Material</a> theme. </aside> <footer id="FOOTER_43"> <nav id="NAV_44"> <div id="DIV_45"></div> <div id="DIV_46"> <a href="http://localhost:1313/adding-content/" id="A_47" title= "Adding content"><span id="SPAN_48">Next</span></a> <div id="DIV_49"> <div id="DIV_50"> <div id="DIV_51"> Adding content </div> </div> <div id="DIV_52"> <i id="I_53"></i> </div> </div> </div> </nav> </footer> </div> </article> </body> </html> CSS: #DIV_1 { box-sizing: border-box; color: rgba(0, 0, 0, 0.870588); height: 808px; text-size-adjust: 100%; width: 699px; column-rule-color: rgba(0, 0, 0, 0.870588); perspective-origin: 349.5px 404px; transform-origin: 349.5px 404px; border: 0px none rgba(0, 0, 0, 0.870588); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgba(0, 0, 0, 0.870588) none 0px; padding: 128px 24px 96px; } /*#DIV_1*/ #H1_2 { box-sizing: border-box; color: rgb(232, 78, 64); height: 95px; text-size-adjust: 100%; width: 651px; column-rule-color: rgb(232, 78, 64); perspective-origin: 325.5px 47.5px; transform-origin: 325.5px 47.5px; border-top: 0px none rgb(232, 78, 64); border-right: 0px none rgb(232, 78, 64); border-bottom: 1px solid rgba(0, 0, 0, 0.117647); border-left: 0px none rgb(232, 78, 64); font: normal normal normal normal 24px / 32px Ubuntu, Helvetica, Arial, sans-serif; margin: 0px; outline: rgb(232, 78, 64) none 0px; padding: 20px 0px 42px; } /*#H1_2*/ #A_3 { box-sizing: border-box; color: rgba(0, 0, 0, 0.258824); display: block; float: right; height: 32px; text-decoration: none; text-size-adjust: 100%; width: 9.34375px; column-rule-color: rgba(0, 0, 0, 0.258824); perspective-origin: 4.67188px 16px; transform-origin: 4.67188px 16px; border: 0px none rgba(0, 0, 0, 0.258824); font: normal normal normal normal 14px / 32px Ubuntu, Helvetica, Arial, sans-serif; margin: 0px 0px 0px 20px; outline: rgba(0, 0, 0, 0.258824) none 0px; transition: color 0.25s ease 0s; } /*#A_3*/ #H2_4, #H2_13 { box-sizing: border-box; color: rgb(232, 78, 64); height: 128px; text-size-adjust: 100%; width: 651px; column-rule-color: rgb(232, 78, 64); perspective-origin: 325.5px 64px; transform-origin: 325.5px 64px; border: 0px none rgb(232, 78, 64); font: normal normal normal normal 20px / 28px Ubuntu, Helvetica, Arial, sans-serif; margin: -64px 0px 0px; outline: rgb(232, 78, 64) none 0px; padding: 100px 0px 0px; } /*#H2_4, #H2_13*/ #A_5, #A_14 { box-sizing: border-box; color: rgba(0, 0, 0, 0.258824); display: block; float: right; height: 28px; text-decoration: none; text-size-adjust: 100%; width: 9.34375px; column-rule-color: rgba(0, 0, 0, 0.258824); perspective-origin: 4.67188px 14px; transform-origin: 4.67188px 14px; border: 0px none rgba(0, 0, 0, 0.258824); font: normal normal normal normal 14px / 28px Ubuntu, Helvetica, Arial, sans-serif; margin: 0px 0px 0px 20px; outline: rgba(0, 0, 0, 0.258824) none 0px; transition: color 0.25s ease 0s; } /*#A_5, #A_14*/ #H3_6 { box-sizing: border-box; color: rgba(0, 0, 0, 0.870588); height: 107px; text-size-adjust: 100%; width: 651px; column-rule-color: rgba(0, 0, 0, 0.870588); perspective-origin: 325.5px 53.5px; transform-origin: 325.5px 53.5px; border: 0px none rgba(0, 0, 0, 0.870588); font: normal normal bold normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; margin: -64px 0px 0px; outline: rgba(0, 0, 0, 0.870588) none 0px; padding: 84px 0px 0px; } /*#H3_6*/ #A_7 { box-sizing: border-box; color: rgba(0, 0, 0, 0.258824); display: block; float: right; height: 23px; text-decoration: none; text-size-adjust: 100%; width: 9.34375px; column-rule-color: rgba(0, 0, 0, 0.258824); perspective-origin: 4.67188px 11.5px; transform-origin: 4.67188px 11.5px; border: 0px none rgba(0, 0, 0, 0.258824); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; margin: 0px 0px 0px 20px; outline: rgba(0, 0, 0, 0.258824) none 0px; transition: color 0.25s ease 0s; } /*#A_7*/ #P_8 { box-sizing: border-box; color: rgba(0, 0, 0, 0.870588); height: 46px; text-size-adjust: 100%; width: 651px; column-rule-color: rgba(0, 0, 0, 0.870588); perspective-origin: 325.5px 23px; transform-origin: 325.5px 23px; border: 0px none rgba(0, 0, 0, 0.870588); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; margin: 21px 0px 0px; outline: rgba(0, 0, 0, 0.870588) none 0px; } /*#P_8*/ #CODE_9, #CODE_10 { box-sizing: border-box; color: rgb(232, 78, 64); text-size-adjust: 100%; white-space: nowrap; column-rule-color: rgb(232, 78, 64); background: rgb(238, 238, 238) none repeat scroll 0% 0% / auto padding-box border-box; border: 0px none rgb(232, 78, 64); font: normal normal normal normal 14px / 23.8px "Ubuntu Mono", "Courier New", Courier, monospace; outline: rgb(232, 78, 64) none 0px; padding: 2px 4px; } /*#CODE_9, #CODE_10*/ #PRE_11 { box-sizing: border-box; color: rgba(0, 0, 0, 0.870588); height: 78px; text-size-adjust: 100%; width: 699px; column-rule-color: rgba(0, 0, 0, 0.870588); perspective-origin: 349.5px 39px; transform-origin: 349.5px 39px; background: rgba(0, 0, 0, 0.0470588) none repeat scroll 0% 0% / auto padding-box border-box; border: 0px none rgba(0, 0, 0, 0.870588); font: normal normal normal normal 14px / 21px "Ubuntu Mono", "Courier New", Courier, monospace; margin: 21px -24px 0px; outline: rgba(0, 0, 0, 0.870588) none 0px; overflow: auto; padding: 21px 24px; } /*#PRE_11*/ #CODE_12 { box-sizing: border-box; color: rgba(0, 0, 0, 0.8); display: block; height: 36px; text-size-adjust: 100%; white-space: pre; width: 651px; column-rule-color: rgba(0, 0, 0, 0.8); perspective-origin: 325.5px 18px; transform-origin: 325.5px 18px; background: rgb(238, 238, 238) none repeat scroll 0% 0% / auto padding-box border-box; border: 0px none rgba(0, 0, 0, 0.8); font: normal normal normal normal 14px / 21px "Ubuntu Mono", "Courier New", Courier, monospace; outline: rgba(0, 0, 0, 0.8) none 0px; overflow: auto; } /*#CODE_12*/ #P_15 { box-sizing: border-box; color: rgba(0, 0, 0, 0.870588); height: 23px; text-size-adjust: 100%; width: 651px; column-rule-color: rgba(0, 0, 0, 0.870588); perspective-origin: 325.5px 11.5px; transform-origin: 325.5px 11.5px; border: 0px none rgba(0, 0, 0, 0.870588); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; margin: 21px 0px 0px; outline: rgba(0, 0, 0, 0.870588) none 0px; } /*#P_15*/ #ASIDE_16 { box-sizing: border-box; color: rgba(0, 0, 0, 0.541176); height: 23px; text-size-adjust: 100%; width: 651px; column-rule-color: rgba(0, 0, 0, 0.541176); perspective-origin: 325.5px 11.5px; transform-origin: 325.5px 11.5px; border: 0px none rgba(0, 0, 0, 0.541176); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; margin: 21px 0px 64px; outline: rgba(0, 0, 0, 0.541176) none 0px; } /*#ASIDE_16*/ #A_17, #A_18 { box-sizing: border-box; color: rgb(232, 78, 64); text-decoration: none; text-size-adjust: 100%; column-rule-color: rgb(232, 78, 64); border-top: 0px none rgb(232, 78, 64); border-right: 0px none rgb(232, 78, 64); border-bottom: 1px dotted rgb(232, 78, 64); border-left: 0px none rgb(232, 78, 64); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(232, 78, 64) none 0px; transition: color 0.25s ease 0s; } /*#A_17, #A_18*/ #FOOTER_19 { bottom: 0px; box-sizing: border-box; color: rgb(255, 255, 255); height: 96px; left: 0px; position: absolute; right: 0px; text-size-adjust: 100%; top: 867px; width: 961px; z-index: 4; column-rule-color: rgb(255, 255, 255); perspective-origin: 480.5px 48px; transform-origin: 480.5px 48px; background: rgb(232, 78, 64) none repeat scroll 0% 0% / auto padding-box border-box; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; padding: 0px 8px; } /*#FOOTER_19*/ #NAV_20 { box-sizing: border-box; color: rgb(255, 255, 255); height: 96px; max-width: 1184px; text-size-adjust: 100%; width: 945px; column-rule-color: rgb(255, 255, 255); perspective-origin: 472.5px 48px; transform-origin: 472.5px 48px; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; overflow: hidden; padding: 8px 0px; } /*#NAV_20*/ #DIV_21 { bottom: 0px; box-sizing: border-box; color: rgb(255, 255, 255); float: left; height: 80px; left: 0px; position: relative; right: 0px; text-size-adjust: 100%; top: 0px; width: 472.5px; column-rule-color: rgb(255, 255, 255); perspective-origin: 236.25px 40px; transform-origin: 236.25px 40px; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; } /*#DIV_21*/ #DIV_22 { bottom: 0px; box-sizing: border-box; color: rgb(255, 255, 255); float: left; height: 80px; left: 0px; position: relative; right: 0px; text-align: right; text-size-adjust: 100%; top: 0px; width: 472.5px; column-rule-color: rgb(255, 255, 255); perspective-origin: 236.25px 40px; transform-origin: 236.25px 40px; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; } /*#DIV_22*/ #A_23 { box-sizing: border-box; color: rgb(232, 78, 64); display: block; height: 80px; text-align: right; text-decoration: none; text-size-adjust: 100%; width: 472.5px; column-rule-color: rgb(232, 78, 64); perspective-origin: 236.25px 40px; transform-origin: 236.25px 40px; border: 0px none rgb(232, 78, 64); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(232, 78, 64) none 0px; transition: color 0.25s ease 0s; } /*#A_23*/ #SPAN_24 { bottom: 40px; box-sizing: border-box; color: rgba(255, 255, 255, 0.701961); display: block; height: 20px; left: 0px; position: absolute; right: 0px; text-align: right; text-size-adjust: 100%; top: 20px; width: 472.5px; column-rule-color: rgba(255, 255, 255, 0.701961); perspective-origin: 236.25px 10px; transform-origin: 236.25px 10px; border: 0px none rgba(255, 255, 255, 0.701961); font: normal normal normal normal 15px / 20px Ubuntu, Helvetica, Arial, sans-serif; outline: rgba(255, 255, 255, 0.701961) none 0px; padding: 0px 56px; } /*#SPAN_24*/ #DIV_25 { bottom: 4px; box-sizing: border-box; color: rgb(232, 78, 64); display: table; height: 48px; left: 0px; position: absolute; right: 0.5px; text-align: right; text-size-adjust: 100%; top: 28px; width: 472px; column-rule-color: rgb(232, 78, 64); perspective-origin: 236px 24px; transform-origin: 236px 24px; border: 0px none rgb(232, 78, 64); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(232, 78, 64) none 0px; } /*#DIV_25*/ #DIV_26 { box-sizing: border-box; color: rgb(232, 78, 64); display: table; height: 47px; table-layout: fixed; text-align: right; text-size-adjust: 100%; width: 424px; column-rule-color: rgb(232, 78, 64); perspective-origin: 212px 23.5px; transform-origin: 212px 23.5px; border: 0px none rgb(232, 78, 64); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(232, 78, 64) none 0px; padding: 0px 8px; } /*#DIV_26*/ #DIV_27 { box-sizing: border-box; color: rgb(255, 255, 255); display: table-cell; height: 47px; text-align: right; text-size-adjust: 100%; text-overflow: ellipsis; white-space: nowrap; width: 408px; column-rule-color: rgb(255, 255, 255); perspective-origin: 204px 23.5px; transform-origin: 204px 23.5px; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 18px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; overflow: hidden; padding: 11px 0px 13px; } /*#DIV_27*/ #DIV_28 { box-sizing: border-box; color: rgb(255, 255, 255); display: table-cell; height: 48px; text-align: right; text-size-adjust: 100%; vertical-align: top; width: 48px; column-rule-color: rgb(255, 255, 255); perspective-origin: 24px 24px; transform-origin: 24px 24px; border: 0px none rgb(255, 255, 255); font: normal normal normal normal 14px / 23.8px Ubuntu, Helvetica, Arial, sans-serif; outline: rgb(255, 255, 255) none 0px; } /*#DIV_28*/ #I_29 { box-sizing: border-box; color: rgb(255, 255, 255); display: inline-block; height: 40px; speak: none; text-align: right; text-size-adjust: 100%; width: 40px; column-rule-color: rgb(255, 255, 255); perspective-origin: 20px 20px; transform-origin: 20px 20px; border: 0px none rgb(255, 255, 255); border-radius: 100% 100% 100% 100%; font: normal normal normal normal 24px / 24px Icon; margin: 4px; outline: rgb(255, 255, 255) none 0px; padding: 8px; transition: background 0.25s ease 0s; } /*#I_29*/ #I_29:before { box-sizing: border-box; color: rgb(255, 255, 255); content: '""'; speak: none; text-align: right; text-size-adjust: 100%; column-rule-color: rgb(255, 255, 255); border: 0px none rgb(255, 255, 255); font: normal normal normal normal 24px / 24px Icon; outline: rgb(255, 255, 255) none 0px; } /*#I_29:before*/
This is causing your problem. .article h2 { padding-top: 100px; margin-top: -64px; } Your H2 tag is overlapping the horizontal bar. So you should balance these numbers, I would do: .article h2 { padding-top: 36px; margin-top: 0px; } Seems not affect your design. And respecting the previous proportion. Make sure to change also your #media areas too. EDIT: How I've discovered the problem, using the devTools. I realized the size of your h2 was overlapping.
Button text bolder than link text despite CSS
I have a link designed as button and and a real button. For some reason the text of both have a different font-weight, despite of the same font-weight and font-size. How can I fix this? The designed pseudo button: .btn { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: inline-block; outline: 0; border: 0; color: #ffffff; text-decoration: none; background-color: #ED7004; font-size: 14px; font-weight: 100; padding: 5px 10px 5px 10px; margin-bottom: 5px; line-height: normal; text-align: center; vertical-align: middle; cursor: pointer; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); -moz-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); } The real button: input[type="button"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: inline-block; outline: 0; border: 0; color: #ffffff; text-decoration: none; background-color: #ED7004; font-size: 14px; font-weight: 100; padding: 5px 10px 5px 10px; margin-bottom: 5px; line-height: normal; text-align: center; vertical-align: middle; cursor: pointer; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); -moz-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); } Thanx!
Are you sure both use the exact same font? With Arial both look pretty much the same to me: HTML: <input type="button" value="Input Button"> <div class="btn">Button Class</div> CSS: .btn { font-family: Arial; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: inline-block; outline: 0; border: 0; color: #ffffff; text-decoration: none; background-color: #ED7004; font-size: 14px; font-weight: 100; padding: 5px 10px 5px 10px; margin-bottom: 5px; line-height: normal; text-align: center; vertical-align: middle; cursor: pointer; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); -moz-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); } input[type="button"] { font-family: Arial; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: block; outline: 0; border: 0; color: #ffffff; text-decoration: none; background-color: #ED7004; font-size: 14px; font-weight: 100; padding: 5px 10px 5px 10px; margin-bottom: 5px; line-height: normal; text-align: center; vertical-align: middle; cursor: pointer; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); -moz-box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); box-shadow: 0 1px 0 rgba(15, 15, 15, 0.3); } Codepen demo Though there are still visible differences between browsers. If you want a light font for the button (and the same look in all browsers) it may be better to use an appropriate (web) font instead of font-weight: 100
-webkit-font-smoothing: antialiased;
font-rendering: geometricPrecision;
Image isn't always inside DIV
I'm trying to wrap an img with a div. The problem is that the image loads left of the div. I currently have an image and div and know the image size prior to it being loaded. The div dimensions are set to the image's dimensions, but the image is loading left of the div. I've tried everything even adding a vertical-align to the image and the closest thing I came across was making the position of the div absolute which just loaded the div under the text which was right of the image. I probably can load the image in another div inside the original but that might harm SEO in my case. Position of the image HTML <ul id="UL_1" class="ab-submenu"> <li id="LI_2"> <a class="ab-item" tabindex="-1" href="http://techdigy.com/wp-admin/profile.php" id="A_3"></a> <div class="avatar-holder" id="DIV_4"> <img alt="" src="http://1.gravatar.com/avatar/95fef2e7b4a23f9cc0439619db1af0a6?s=64&d=identicon&r=G" class="avatar avatar-64 photo" height="64" width="64" id="IMG_5" /> </div><span class="display-name" id="SPAN_6">Andre</span> </li> <li id="LI_7"> <a class="ab-item" href="http://techdigy.com/wp-admin/profile.php" id="A_8">Edit My Profile</a> </li> <li id="LI_9"> <a class="ab-item" href="http://techdigy.com/wp-login.php?action=logout&_wpnonce=c7d2e50651" id="A_10">Log Out</a> </li> </ul> CSS #UL_1 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(204, 204, 204); color: rgb(204, 204, 204); font: normal normal normal 13px/28px sans-serif; height: auto; line-height: 28px; list-style: none outside none; margin: 0px; outline: rgb(204, 204, 204) none 0px; padding: 6px 0px; position: relative; text-align: left; text-shadow: rgb(68, 68, 68) 0px -1px 0px; transition: none 0s ease 0s; width: auto; z-index: 99999; }/*#UL_1*/ #LI_2 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(204, 204, 204); color: rgb(204, 204, 204); font: normal normal normal 13px/28px sans-serif; height: auto; line-height: 28px; list-style: none outside none; margin: 6px 16px 15px 88px; outline: rgb(204, 204, 204) none 0px; position: relative; text-shadow: rgb(68, 68, 68) 0px -1px 0px; transition: none 0s ease 0s; width: auto; z-index: 99999; }/*#LI_2*/ #A_3 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(33, 117, 155); color: rgb(33, 117, 155); display: block; font: normal normal normal 13px/26px sans-serif; line-height: 26px; list-style: none outside none; min-width: 140px; outline: rgb(33, 117, 155) none 0px; padding: 0px 12px 0px 8px; text-align: left; text-decoration: none; transition: none 0s ease 0s; white-space: nowrap; }/*#A_3*/ #DIV_4 { border: 0px none rgb(204, 204, 204); color: rgb(204, 204, 204); font: normal normal normal 13px/28px sans-serif; height: 64px; line-height: 28px; list-style: none outside none; outline: rgb(204, 204, 204) none 0px; text-align: left; text-shadow: rgb(68, 68, 68) 0px -1px 0px; transition: none 0s ease 0s; white-space: nowrap; width: 64px; }/*#DIV_4*/ #IMG_5 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(204, 204, 204); color: rgb(204, 204, 204); display: block; font: normal normal normal 13px/28px sans-serif; height: 64px; left: -72px; line-height: 28px; list-style: none outside none; outline: rgb(204, 204, 204) none 0px; position: absolute; text-align: left; text-shadow: rgb(68, 68, 68) 0px -1px 0px; top: 4px; transition: none 0s ease 0s; vertical-align: middle; white-space: nowrap; width: 64px; }/*#IMG_5*/ #SPAN_6 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(51, 51, 51); color: rgb(51, 51, 51); display: block; font: normal normal normal 13px/28px sans-serif; height: 18px; line-height: 28px; list-style: none outside none; outline: rgb(51, 51, 51) none 0px; text-align: left; transition: none 0s ease 0s; white-space: nowrap; }/*#SPAN_6*/ #LI_7, #LI_9 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(204, 204, 204); color: rgb(204, 204, 204); font: normal normal normal 13px/28px sans-serif; height: auto; line-height: 28px; list-style: none outside none; margin: 0px 16px 0px 88px; outline: rgb(204, 204, 204) none 0px; position: relative; text-shadow: rgb(68, 68, 68) 0px -1px 0px; transition: none 0s ease 0s; width: auto; z-index: 99999; }/*#LI_7, #LI_9*/ #A_8, #A_10 { background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box; border: 0px none rgb(33, 117, 155); color: rgb(33, 117, 155); display: block; font: normal normal normal 13px/26px sans-serif; height: 26px; line-height: 26px; list-style: none outside none; min-width: 140px; outline: rgb(33, 117, 155) none 0px; padding: 0px 12px 0px 8px; text-align: left; text-decoration: none; transition: none 0s ease 0s; white-space: nowrap; }/*#A_8, #A_10*/
This is the correct behavior, you are positioning the img absolutely -72px left and 4px from the top. #IMG_5 { position:absolute; left: -72px; top: 4px; } If you want the img to be inside the div, then remove the absolute positioning. If you were trying to move the div apply this positioning to it as opposed to the img. In doing so, the img will also have the same position, as it is a child. jsFiddle example
What in this CSS is causing this difference in font thickness?
I have two bits of text. One is in a paragraph element, the other is text for a submit button input. Why is the font slightly thicker in the button? Paragraph CSS (taken from Computed Style in Chrome Developer Tools) box-sizing: border-box; color: rgb(255, 255, 255); display: block; float: left; font-family: 'Din Text Pro Regular', Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-weight: normal; height: 24px; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 16px; margin-top: 11.199999809265137px; width: 119px; Input CSS (taken from Computed Style in Chrome Developer Tools) -webkit-appearance: none; -webkit-border-image: none; -webkit-box-align: center; -webkit-box-shadow: rgba(0, 0, 0, 0.65098) 0px 1px 3px 0px, rgba(97, 232, 203, 0.701961) 0px 1px 0px 0px inset; -webkit-rtl-ordering: logical; -webkit-user-select: text; -webkit-writing-mode: horizontal-tb; background-color: rgb(192, 192, 192); background-image: -webkit-linear-gradient(top, rgb(75, 208, 179), rgb(38, 174, 144)); border-bottom-color: rgb(255, 255, 255); border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-bottom-style: none; border-bottom-width: 0px; border-left-color: rgb(255, 255, 255); border-left-style: none; border-left-width: 0px; border-right-color: rgb(255, 255, 255); border-right-style: none; border-right-width: 0px; border-top-color: rgb(255, 255, 255); border-top-left-radius: 5px; border-top-right-radius: 5px; border-top-style: none; border-top-width: 0px; box-shadow: rgba(0, 0, 0, 0.65098) 0px 1px 3px 0px, rgba(97, 232, 203, 0.701961) 0px 1px 0px 0px inset; box-sizing: border-box; color: rgb(255, 255, 255); cursor: pointer; display: inline-block; font-family: 'Din Text Pro Regular', Arial, Helvetica, sans-serif; font-size: 16px; height: 41px; letter-spacing: normal; line-height: 16px; margin-bottom: 0px; margin-left: 10px; margin-right: 0px; margin-top: 0px; padding-bottom: 10px; padding-left: 20px; padding-right: 20px; padding-top: 11px; text-align: center; text-indent: 0px; text-shadow: rgba(24, 97, 81, 0.34902) 0px 1px 0px; text-transform: none; vertical-align: baseline; white-space: pre; width: 159px; word-spacing: 0px; writing-mode: lr-tb;
I was able to put this at the top of my CSS. It seems to do the trick, at least so far: button { -webkit-font-smoothing: antialiased; }
Apparently, Chrome as some kind of bug, in which it displays the fonts thicker depending on the brightness of its color. More info here: https://code.google.com/p/chromium/issues/detail?id=163369 Edit: Found more related info and fix Actually, it is a known bug: I was able to fix this by following this article. Kinda late, but it may still be usefull to some.