primary-menu.css

Same filename in other branches
  1. 9 core/themes/bartik/css/components/primary-menu.css
/* --------------- Primary Menu ------------ */

.region-primary-menu {
  clear: both;
}
.region-primary-menu .menu {
  margin: 0 5px;
  padding: 0;
  text-align: left; /* LTR */
  font-size: 0.929em;
}
[dir="rtl"] .region-primary-menu .menu {
  margin-right: 5px; /* This is required to win over specificity of [dir="rtl"] ul.menu */
  margin-left: 5px; /* This is required to win over specificity of [dir="rtl"] ul.menu */
  text-align: right;
}
.region-primary-menu .menu-item {
  float: none;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.region-primary-menu .menu a {
  display: block;
  float: none;
  margin: 4px 0;
  padding: 0.9em 0 0.9em 10px; /* LTR */
  text-decoration: none;
  color: #333;
  border-radius: 8px;
  background: #ccc;
  background: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px #eee;
}
[dir="rtl"] .region-primary-menu .menu a {
  padding: 0.9em 10px 0.9em 0;
}
.region-primary-menu .menu a:hover,
.region-primary-menu .menu a:focus {
  background: #f6f6f2;
  background: rgba(255, 255, 255, 0.95);
}
.region-primary-menu .menu a:active {
  background: #b3b3b3;
  background: rgba(255, 255, 255, 1);
}
.region-primary-menu .menu-item a.is-active {
  border-bottom: none;
}

/* ---------- Primary Menu Toggle ----------- */
/* Hide the toggle by default. */
.menu-toggle,
.menu-toggle-target {
  display: none;
}
/* Unhide it for the primary menu. */
.region-primary-menu .menu-toggle-target {
  position: fixed;
  top: 0;
  display: inherit;
}
.region-primary-menu .menu-toggle {
  display: none;
}
body:not(:target) .region-primary-menu .menu-toggle {
  z-index: 1000;
  display: block;
  float: none;
  padding: 0.9em 10px 0.9em 10px;
  text-decoration: none;
  color: #333;
  background: #ccc;
  background: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px #eee;
  font-size: 0.929em;
}
body:not(:target) .region-primary-menu .menu-toggle:after {
  position: absolute;
  right: 10px; /* LTR */
  display: inline-block;
  width: 22px;
  height: 22px;
  content: "";
  background: url(../../../../misc/icons/ffffff/hamburger.svg) no-repeat;
  background-size: contain;
}
[dir="rtl"] body:not(:target) .region-primary-menu .menu-toggle:after {
  right: initial;
  left: 10px;
}
body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle,
body:not(:target) .region-primary-menu .menu-toggle--hide {
  display: none;
}
body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle--hide {
  display: block;
}

body:not(:target) .region-primary-menu .menu-item {
  overflow: hidden;
  height: 0;
}
body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu .menu-item {
  overflow: visible;
  height: auto;
}

/**
 * Media queries for primary menu.
 */
@media all and (min-width: 461px) and (max-width: 900px) {
  .region-primary-menu .menu {
    margin: 0 5px;
    padding: 0;
    text-align: center;
  }
  /* This is required to win over specificity of the global [dir="rtl"] .region-primary-menu .menu */
  [dir="rtl"] .region-primary-menu .menu {
    text-align: center;
  }
  .region-primary-menu .menu-item,
  body:not(:target) .region-primary-menu .menu-item {
    display: inline-block;
    float: left; /* LTR */
    overflow: visible;
    width: 32.75%;
    height: auto;
    margin-right: 5px; /* LTR */
    padding: 0;
  }
  [dir="rtl"] .region-primary-menu .menu-item,
  [dir="rtl"] body:not(:target) .region-primary-menu .menu-item {
    float: right;
    margin-right: 0;
    margin-left: 5px;
  }
  .region-primary-menu .menu-item:nth-child(3n) {
    margin-right: -5px; /* LTR */
  }
  [dir="rtl"] .region-primary-menu .menu-item:nth-child(3n) {
    margin-right: 0;
    margin-left: -5px;
  }
  .region-primary-menu .menu a {
    display: block;
    float: none;
    margin-bottom: 5px;
    padding: 0.9em 5px;
    border-radius: 8px;
  }
  /* This is required to win over specificity of the global [dir="rtl"] .region-primary-menu .menu a */
  [dir="rtl"] .region-primary-menu .menu a {
    padding: 0.9em 5px;
  }
  body:not(:target) .region-primary-menu .menu-toggle {
    display: none;
  }
}

@media all and (min-width: 901px) {
  .region-primary-menu .block-menu .menu {
    margin: 0;
    padding: 0 15px;
    font-size: 0.929em;
  }
  .region-primary-menu .menu-item,
  body:not(:target) .region-primary-menu .menu-item {
    float: left; /* LTR */
    overflow: visible;
    width: auto;
    height: auto;
    margin: 0 1px;
    padding: 0 1px;
    list-style: none;
  }
  [dir="rtl"] .region-primary-menu .menu-item,
  [dir="rtl"] body:not(:target) .region-primary-menu .menu-item {
    float: right;
  }
  .region-primary-menu .menu a {
    float: left; /* LTR */
    margin-bottom: 0;
    padding: 0.7em 0.8em;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
  }
  [dir="rtl"] .region-primary-menu .menu a {
    float: right;
    padding: 0.7em 0.8em;
  }
  .featured .region-primary-menu .menu-item a:active,
  .featured .region-primary-menu .menu-item a.is-active {
    background: #f0f0f0;
    background: rgba(240, 240, 240, 1);
  }
  body:not(:target) .region-primary-menu .menu-toggle {
    display: none;
  }
}

/**
 * Ensures that the open mobile menu hides when the screen dimensions become
 * 461px or wider.
 */
@media all and (min-width: 461px) {
  body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle--hide {
    display: none;
  }
}

File

core/themes/bartik/css/components/primary-menu.css

View source
  1. /* --------------- Primary Menu ------------ */
  2. .region-primary-menu {
  3. clear: both;
  4. }
  5. .region-primary-menu .menu {
  6. margin: 0 5px;
  7. padding: 0;
  8. text-align: left; /* LTR */
  9. font-size: 0.929em;
  10. }
  11. [dir="rtl"] .region-primary-menu .menu {
  12. margin-right: 5px; /* This is required to win over specificity of [dir="rtl"] ul.menu */
  13. margin-left: 5px; /* This is required to win over specificity of [dir="rtl"] ul.menu */
  14. text-align: right;
  15. }
  16. .region-primary-menu .menu-item {
  17. float: none;
  18. width: 100%;
  19. height: auto;
  20. margin: 0;
  21. padding: 0;
  22. list-style: none;
  23. }
  24. .region-primary-menu .menu a {
  25. display: block;
  26. float: none;
  27. margin: 4px 0;
  28. padding: 0.9em 0 0.9em 10px; /* LTR */
  29. text-decoration: none;
  30. color: #333;
  31. border-radius: 8px;
  32. background: #ccc;
  33. background: rgba(255, 255, 255, 0.7);
  34. text-shadow: 0 1px #eee;
  35. }
  36. [dir="rtl"] .region-primary-menu .menu a {
  37. padding: 0.9em 10px 0.9em 0;
  38. }
  39. .region-primary-menu .menu a:hover,
  40. .region-primary-menu .menu a:focus {
  41. background: #f6f6f2;
  42. background: rgba(255, 255, 255, 0.95);
  43. }
  44. .region-primary-menu .menu a:active {
  45. background: #b3b3b3;
  46. background: rgba(255, 255, 255, 1);
  47. }
  48. .region-primary-menu .menu-item a.is-active {
  49. border-bottom: none;
  50. }
  51. /* ---------- Primary Menu Toggle ----------- */
  52. /* Hide the toggle by default. */
  53. .menu-toggle,
  54. .menu-toggle-target {
  55. display: none;
  56. }
  57. /* Unhide it for the primary menu. */
  58. .region-primary-menu .menu-toggle-target {
  59. position: fixed;
  60. top: 0;
  61. display: inherit;
  62. }
  63. .region-primary-menu .menu-toggle {
  64. display: none;
  65. }
  66. body:not(:target) .region-primary-menu .menu-toggle {
  67. z-index: 1000;
  68. display: block;
  69. float: none;
  70. padding: 0.9em 10px 0.9em 10px;
  71. text-decoration: none;
  72. color: #333;
  73. background: #ccc;
  74. background: rgba(255, 255, 255, 0.7);
  75. text-shadow: 0 1px #eee;
  76. font-size: 0.929em;
  77. }
  78. body:not(:target) .region-primary-menu .menu-toggle:after {
  79. position: absolute;
  80. right: 10px; /* LTR */
  81. display: inline-block;
  82. width: 22px;
  83. height: 22px;
  84. content: "";
  85. background: url(../../../../misc/icons/ffffff/hamburger.svg) no-repeat;
  86. background-size: contain;
  87. }
  88. [dir="rtl"] body:not(:target) .region-primary-menu .menu-toggle:after {
  89. right: initial;
  90. left: 10px;
  91. }
  92. body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle,
  93. body:not(:target) .region-primary-menu .menu-toggle--hide {
  94. display: none;
  95. }
  96. body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle--hide {
  97. display: block;
  98. }
  99. body:not(:target) .region-primary-menu .menu-item {
  100. overflow: hidden;
  101. height: 0;
  102. }
  103. body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu .menu-item {
  104. overflow: visible;
  105. height: auto;
  106. }
  107. /**
  108. * Media queries for primary menu.
  109. */
  110. @media all and (min-width: 461px) and (max-width: 900px) {
  111. .region-primary-menu .menu {
  112. margin: 0 5px;
  113. padding: 0;
  114. text-align: center;
  115. }
  116. /* This is required to win over specificity of the global [dir="rtl"] .region-primary-menu .menu */
  117. [dir="rtl"] .region-primary-menu .menu {
  118. text-align: center;
  119. }
  120. .region-primary-menu .menu-item,
  121. body:not(:target) .region-primary-menu .menu-item {
  122. display: inline-block;
  123. float: left; /* LTR */
  124. overflow: visible;
  125. width: 32.75%;
  126. height: auto;
  127. margin-right: 5px; /* LTR */
  128. padding: 0;
  129. }
  130. [dir="rtl"] .region-primary-menu .menu-item,
  131. [dir="rtl"] body:not(:target) .region-primary-menu .menu-item {
  132. float: right;
  133. margin-right: 0;
  134. margin-left: 5px;
  135. }
  136. .region-primary-menu .menu-item:nth-child(3n) {
  137. margin-right: -5px; /* LTR */
  138. }
  139. [dir="rtl"] .region-primary-menu .menu-item:nth-child(3n) {
  140. margin-right: 0;
  141. margin-left: -5px;
  142. }
  143. .region-primary-menu .menu a {
  144. display: block;
  145. float: none;
  146. margin-bottom: 5px;
  147. padding: 0.9em 5px;
  148. border-radius: 8px;
  149. }
  150. /* This is required to win over specificity of the global [dir="rtl"] .region-primary-menu .menu a */
  151. [dir="rtl"] .region-primary-menu .menu a {
  152. padding: 0.9em 5px;
  153. }
  154. body:not(:target) .region-primary-menu .menu-toggle {
  155. display: none;
  156. }
  157. }
  158. @media all and (min-width: 901px) {
  159. .region-primary-menu .block-menu .menu {
  160. margin: 0;
  161. padding: 0 15px;
  162. font-size: 0.929em;
  163. }
  164. .region-primary-menu .menu-item,
  165. body:not(:target) .region-primary-menu .menu-item {
  166. float: left; /* LTR */
  167. overflow: visible;
  168. width: auto;
  169. height: auto;
  170. margin: 0 1px;
  171. padding: 0 1px;
  172. list-style: none;
  173. }
  174. [dir="rtl"] .region-primary-menu .menu-item,
  175. [dir="rtl"] body:not(:target) .region-primary-menu .menu-item {
  176. float: right;
  177. }
  178. .region-primary-menu .menu a {
  179. float: left; /* LTR */
  180. margin-bottom: 0;
  181. padding: 0.7em 0.8em;
  182. border-bottom-right-radius: 0;
  183. border-bottom-left-radius: 0;
  184. }
  185. [dir="rtl"] .region-primary-menu .menu a {
  186. float: right;
  187. padding: 0.7em 0.8em;
  188. }
  189. .featured .region-primary-menu .menu-item a:active,
  190. .featured .region-primary-menu .menu-item a.is-active {
  191. background: #f0f0f0;
  192. background: rgba(240, 240, 240, 1);
  193. }
  194. body:not(:target) .region-primary-menu .menu-toggle {
  195. display: none;
  196. }
  197. }
  198. /**
  199. * Ensures that the open mobile menu hides when the screen dimensions become
  200. * 461px or wider.
  201. */
  202. @media all and (min-width: 461px) {
  203. body:not(:target) .region-primary-menu .menu-toggle-target-show:target ~ .menu-toggle--hide {
  204. display: none;
  205. }
  206. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.