Default.css 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  1. /* Default user-agent stylesheet for LibWeb
  2. * Note: This stylesheet starts with a bunch of ad-hoc custom rules.
  3. * After that, rules from the HTML spec follow.
  4. */
  5. html {
  6. font-family: serif;
  7. color: CanvasText;
  8. }
  9. body {
  10. margin: 8px;
  11. }
  12. center {
  13. text-align: -libweb-center;
  14. }
  15. blink {
  16. display: inline;
  17. }
  18. /* FIXME: This doesn't seem right. */
  19. label {
  20. display: inline-block;
  21. }
  22. /* FIXME: This is a temporary hack until we can render a native-looking frame for these. */
  23. input, textarea {
  24. border: 1px solid ButtonBorder;
  25. min-width: 80px;
  26. min-height: 16px;
  27. width: 120px;
  28. cursor: text;
  29. overflow: hidden;
  30. }
  31. textarea {
  32. padding: 2px;
  33. display: inline-block;
  34. overflow: auto;
  35. font-family: monospace;
  36. width: attr(cols ch, 20ch);
  37. height: attr(rows lh, 2lh);
  38. }
  39. input[type=submit], input[type=button], input[type=reset], input[type=checkbox], input[type=radio] {
  40. border: none;
  41. min-width: unset;
  42. min-height: unset;
  43. width: unset;
  44. cursor: unset;
  45. }
  46. input::placeholder {
  47. color: GrayText;
  48. }
  49. button, input[type=submit], input[type=button], input[type=reset] {
  50. padding: 1px 4px;
  51. background-color: ButtonFace;
  52. border: 1px solid ButtonBorder;
  53. color: ButtonText;
  54. }
  55. button:hover, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover {
  56. /* FIXME: There isn't a <system-color> keyword for this, so this is a slightly lightened
  57. * version of our light ButtonFace color. Once we support `color-scheme: dark`
  58. * we'll need to use a different color for that.
  59. */
  60. background-color: #e5e0d7;
  61. }
  62. option {
  63. display: none;
  64. }
  65. /* 15.3.1 Hidden elements
  66. * https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements
  67. */
  68. area, base, basefont, datalist, head, link, meta, noembed,
  69. noframes, param, rp, script, style, template, title {
  70. display: none;
  71. }
  72. [hidden]:not([hidden=until-found i]) {
  73. display: none;
  74. }
  75. [hidden=until-found i]:not(embed) {
  76. content-visibility: hidden;
  77. }
  78. embed[hidden] {
  79. display: inline;
  80. height: 0;
  81. width: 0;
  82. }
  83. input[type=hidden i] {
  84. display: none !important;
  85. }
  86. @media (scripting) {
  87. noscript {
  88. display: none !important;
  89. }
  90. }
  91. /* 15.3.2 The page
  92. * https://html.spec.whatwg.org/multipage/rendering.html#the-page
  93. */
  94. html, body {
  95. display: block;
  96. }
  97. /* 15.3.3 Flow content
  98. * https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3
  99. */
  100. address, blockquote, center, dialog, div, figure, figcaption, footer, form,
  101. header, hr, legend, listing, main, p, plaintext, pre, search, xmp {
  102. display: block;
  103. }
  104. blockquote, figure, listing, p, plaintext, pre, xmp {
  105. margin-top: 1em;
  106. margin-bottom: 1em;
  107. }
  108. blockquote, figure {
  109. margin-left: 40px;
  110. margin-right: 40px;
  111. }
  112. address {
  113. font-style: italic;
  114. }
  115. listing, plaintext, pre, xmp {
  116. font-family: monospace;
  117. white-space: pre;
  118. }
  119. dialog:not([open]) {
  120. display: none;
  121. }
  122. dialog {
  123. position: absolute;
  124. inset-inline-start: 0;
  125. inset-inline-end: 0;
  126. width: fit-content;
  127. height: fit-content;
  128. margin: auto;
  129. border: solid;
  130. padding: 1em;
  131. background-color: Canvas;
  132. color: CanvasText;
  133. }
  134. dialog:modal {
  135. position: fixed;
  136. overflow: auto;
  137. inset-block: 0;
  138. max-width: calc(100% - 6px - 2em);
  139. max-height: calc(100% - 6px - 2em);
  140. }
  141. dialog::backdrop {
  142. background: rgba(0, 0, 0, 0.1);
  143. }
  144. [popover]:not(:popover-open):not(dialog[open]) {
  145. display:none;
  146. }
  147. dialog:popover-open {
  148. display:block;
  149. }
  150. [popover] {
  151. position: fixed;
  152. inset: 0;
  153. width: fit-content;
  154. height: fit-content;
  155. margin: auto;
  156. border: solid;
  157. padding: 0.25em;
  158. overflow: auto;
  159. color: CanvasText;
  160. background-color: Canvas;
  161. }
  162. :popover-open::backdrop {
  163. position: fixed;
  164. inset: 0;
  165. pointer-events: none !important;
  166. background-color: transparent;
  167. }
  168. slot {
  169. display: contents;
  170. }
  171. /* 15.3.4 Phrasing content
  172. * https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3
  173. */
  174. cite, dfn, em, i, var {
  175. font-style: italic;
  176. }
  177. b, strong {
  178. font-weight: bolder;
  179. }
  180. code, kbd, samp, tt {
  181. font-family: monospace;
  182. }
  183. big {
  184. font-size: larger;
  185. }
  186. small {
  187. font-size: smaller;
  188. }
  189. sub {
  190. vertical-align: sub;
  191. }
  192. sup {
  193. vertical-align: super;
  194. }
  195. sub, sup {
  196. line-height: normal;
  197. font-size: smaller;
  198. }
  199. ruby {
  200. display: ruby;
  201. }
  202. rt {
  203. display: ruby-text;
  204. }
  205. :link {
  206. color: LinkText;
  207. }
  208. :visited {
  209. color: VisitedText;
  210. }
  211. :link:active, :visited:active {
  212. color: ActiveText;
  213. }
  214. :link, :visited {
  215. text-decoration: underline;
  216. cursor: pointer;
  217. }
  218. :focus-visible {
  219. outline: auto;
  220. }
  221. mark {
  222. background: Mark;
  223. color: MarkText;
  224. }
  225. abbr[title], acronym[title] {
  226. text-decoration: dotted underline;
  227. }
  228. ins, u {
  229. text-decoration: underline;
  230. }
  231. del, s, strike {
  232. text-decoration: line-through;
  233. }
  234. q::before {
  235. content: open-quote;
  236. }
  237. q::after {
  238. content: close-quote;
  239. }
  240. /*
  241. NOTE: This isn't a real property and value. See https://github.com/whatwg/html/issues/2291
  242. br {
  243. display-outside: newline;
  244. }
  245. */
  246. /* this also has bidi implications */
  247. nobr {
  248. white-space: nowrap;
  249. }
  250. /*
  251. NOTE: This isn't a real property and value. See https://github.com/whatwg/html/issues/2291
  252. wbr {
  253. display-outside: break-opportunity;
  254. }
  255. */
  256. /* this also has bidi implications */
  257. nobr wbr {
  258. white-space: normal;
  259. }
  260. /* 15.3.5 Bidirectional text
  261. * https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering
  262. */
  263. [dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) {
  264. direction: ltr;
  265. }
  266. [dir]:dir(rtl), bdi:dir(rtl) {
  267. direction: rtl;
  268. }
  269. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  270. legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
  271. h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
  272. tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
  273. [dir=ltr i], [dir=rtl i], [dir=auto i] {
  274. unicode-bidi: isolate;
  275. }
  276. bdo, bdo[dir] {
  277. unicode-bidi: isolate-override;
  278. }
  279. input[dir=auto i]:is([type=search i], [type=tel i], [type=url i],
  280. [type=email i]), textarea[dir=auto i], pre[dir=auto i] {
  281. unicode-bidi: plaintext;
  282. }
  283. /* 15.3.6 Sections and headings
  284. * https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings
  285. */
  286. article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
  287. display: block;
  288. }
  289. h1 {
  290. margin-top: 0.67em;
  291. margin-bottom: 0.67em;
  292. font-size: 2.00em;
  293. font-weight: bold;
  294. }
  295. h2 {
  296. margin-top: 0.83em;
  297. margin-bottom: 0.83em;
  298. font-size: 1.50em;
  299. font-weight: bold;
  300. }
  301. h3 {
  302. margin-top: 1.00em;
  303. margin-bottom: 1.00em;
  304. font-size: 1.17em;
  305. font-weight: bold;
  306. }
  307. h4 {
  308. margin-top: 1.33em;
  309. margin-bottom: 1.33em;
  310. font-size: 1.00em;
  311. font-weight: bold;
  312. }
  313. h5 {
  314. margin-top: 1.67em;
  315. margin-bottom: 1.67em;
  316. font-size: 0.83em;
  317. font-weight: bold;
  318. }
  319. h6 {
  320. margin-top: 2.33em;
  321. margin-bottom: 2.33em;
  322. font-size: 0.67em;
  323. font-weight: bold;
  324. }
  325. :is(article, aside, nav, section) h1 {
  326. margin-top: 0.83em;
  327. margin-bottom: 0.83em;
  328. font-size: 1.50em;
  329. }
  330. :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  331. margin-top: 1.00em;
  332. margin-bottom: 1.00em;
  333. font-size: 1.17em;
  334. }
  335. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  336. margin-top: 1.33em;
  337. margin-bottom: 1.33em;
  338. font-size: 1.00em;
  339. }
  340. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  341. margin-top: 1.67em;
  342. margin-bottom: 1.67em;
  343. font-size: 0.83em;
  344. }
  345. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  346. margin-top: 2.33em;
  347. margin-bottom: 2.33em;
  348. font-size: 0.67em;
  349. }
  350. /* 15.3.7 Lists
  351. * https://html.spec.whatwg.org/multipage/rendering.html#lists
  352. */
  353. dir, dd, dl, dt, menu, ol, ul {
  354. display: block;
  355. }
  356. li {
  357. display: list-item;
  358. text-align: match-parent;
  359. }
  360. dir, dl, menu, ol, ul {
  361. margin-block-start: 1em;
  362. margin-block-end: 1em;
  363. }
  364. :is(dir, dl, menu, ol, ul) :is(dir, dl, menu, ol, ul) {
  365. margin-block-start: 0;
  366. margin-block-end: 0;
  367. }
  368. dd {
  369. margin-inline-start: 40px;
  370. }
  371. dir, menu, ol, ul {
  372. padding-inline-start: 40px;
  373. }
  374. ol, ul, menu {
  375. counter-reset: list-item;
  376. }
  377. ol {
  378. list-style-type: decimal;
  379. }
  380. dir, menu, ul {
  381. list-style-type: disc;
  382. }
  383. :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  384. list-style-type: circle;
  385. }
  386. :is(dir, menu, ol, ul) :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  387. list-style-type: square;
  388. }
  389. /* 15.3.8 Tables
  390. * https://html.spec.whatwg.org/multipage/rendering.html#tables-2
  391. */
  392. table {
  393. display: table;
  394. }
  395. caption {
  396. display: table-caption;
  397. }
  398. colgroup, colgroup[hidden] {
  399. display: table-column-group;
  400. }
  401. col, col[hidden] {
  402. display: table-column;
  403. }
  404. thead, thead[hidden] {
  405. display: table-header-group;
  406. }
  407. tbody, tbody[hidden] {
  408. display: table-row-group;
  409. }
  410. tfoot, tfoot[hidden] {
  411. display: table-footer-group;
  412. }
  413. tr, tr[hidden] {
  414. display: table-row;
  415. }
  416. td, th {
  417. display: table-cell;
  418. }
  419. colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
  420. tfoot[hidden], tr[hidden] {
  421. visibility: collapse;
  422. }
  423. table {
  424. box-sizing: border-box;
  425. border-spacing: 2px;
  426. border-collapse: separate;
  427. text-indent: initial;
  428. }
  429. td, th {
  430. padding: 1px;
  431. }
  432. th {
  433. font-weight: bold;
  434. /*
  435. The text-align property for table headings is non-standard, but all
  436. existing user-agents seem to render them centered by default.
  437. See:
  438. - https://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css?rev=295625#L272
  439. - https://searchfox.org/mozilla-central/rev/0b55b868c17835942d40ca3fedfca8057481207b/layout/style/res/html.css#473
  440. */
  441. text-align: center;
  442. }
  443. caption {
  444. text-align: center;
  445. }
  446. thead, tbody, tfoot, table > tr {
  447. vertical-align: middle;
  448. }
  449. tr, td, th {
  450. vertical-align: inherit;
  451. }
  452. thead, tbody, tfoot, tr {
  453. border-color: inherit;
  454. }
  455. table[rules=none i], table[rules=groups i], table[rules=rows i],
  456. table[rules=cols i], table[rules=all i], table[frame=void i],
  457. table[frame=above i], table[frame=below i], table[frame=hsides i],
  458. table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
  459. table[frame=box i], table[frame=border i],
  460. table[rules=none i] > tr > td, table[rules=none i] > tr > th,
  461. table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
  462. table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
  463. table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
  464. table[rules=all i] > tr > td, table[rules=all i] > tr > th,
  465. table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
  466. table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
  467. table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
  468. table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
  469. table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
  470. table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
  471. table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
  472. table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
  473. table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
  474. table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
  475. table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
  476. table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
  477. table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th,
  478. table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
  479. table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
  480. border-color: black;
  481. }
  482. /* 15.3.10 Form controls
  483. * https://html.spec.whatwg.org/multipage/rendering.html#form-controls
  484. */
  485. input, select, button, textarea {
  486. letter-spacing: initial;
  487. word-spacing: initial;
  488. line-height: initial;
  489. text-transform: initial;
  490. text-indent: initial;
  491. text-shadow: initial;
  492. appearance: auto;
  493. }
  494. input, select, textarea {
  495. text-align: initial;
  496. }
  497. input:is([type=reset i], [type=button i], [type=submit i]), button {
  498. text-align: center;
  499. }
  500. input, button {
  501. display: inline-block;
  502. }
  503. input[type=hidden i], input[type=file i], input[type=image i] {
  504. appearance: none;
  505. }
  506. input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i],
  507. [type=submit i], [type=color i], [type=search i]), select, button {
  508. box-sizing: border-box;
  509. }
  510. textarea {
  511. white-space: pre-wrap;
  512. }
  513. /* 15.3.11 The hr element
  514. * https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
  515. */
  516. hr {
  517. color: gray;
  518. border-style: inset;
  519. border-width: 1px;
  520. margin-block-start: 0.5em;
  521. margin-inline-end: auto;
  522. margin-block-end: 0.5em;
  523. margin-inline-start: auto;
  524. overflow: hidden;
  525. }
  526. /* 15.3.12 The fieldset and legend elements
  527. * https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements
  528. */
  529. fieldset {
  530. display: block;
  531. margin-inline-start: 2px;
  532. margin-inline-end: 2px;
  533. border: groove 2px ThreeDFace;
  534. padding-block-start: 0.35em;
  535. padding-inline-end: 0.75em;
  536. padding-block-end: 0.625em;
  537. padding-inline-start: 0.75em;
  538. min-inline-size: min-content;
  539. }
  540. legend {
  541. padding-left: 2px;
  542. padding-right: 2px;
  543. }
  544. legend[align=left i] {
  545. justify-self: left;
  546. }
  547. legend[align=center i] {
  548. justify-self: center;
  549. }
  550. legend[align=right i] {
  551. justify-self: right;
  552. }
  553. /* 15.4.1 Embedded content
  554. * https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules
  555. */
  556. iframe {
  557. border: 2px inset;
  558. }
  559. video {
  560. object-fit: contain;
  561. }
  562. /* 15.4.3 Attributes for embedded content and images
  563. * https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
  564. */
  565. iframe[frameborder='0'], iframe[frameborder=no i] { border: none; }
  566. embed[align=left i], iframe[align=left i], img[align=left i],
  567. input[type=image i][align=left i], object[align=left i] {
  568. float: left;
  569. }
  570. embed[align=right i], iframe[align=right i], img[align=right i],
  571. input[type=image i][align=right i], object[align=right i] {
  572. float: right;
  573. }
  574. embed[align=top i], iframe[align=top i], img[align=top i],
  575. input[type=image i][align=top i], object[align=top i] {
  576. vertical-align: top;
  577. }
  578. embed[align=baseline i], iframe[align=baseline i], img[align=baseline i],
  579. input[type=image i][align=baseline i], object[align=baseline i] {
  580. vertical-align: baseline;
  581. }
  582. embed[align=texttop i], iframe[align=texttop i], img[align=texttop i],
  583. input[type=image i][align=texttop i], object[align=texttop i] {
  584. vertical-align: text-top;
  585. }
  586. embed[align=absmiddle i], iframe[align=absmiddle i], img[align=absmiddle i],
  587. input[type=image i][align=absmiddle i], object[align=absmiddle i],
  588. embed[align=abscenter i], iframe[align=abscenter i], img[align=abscenter i],
  589. input[type=image i][align=abscenter i], object[align=abscenter i] {
  590. vertical-align: middle;
  591. }
  592. embed[align=bottom i], iframe[align=bottom i], img[align=bottom i],
  593. input[type=image i][align=bottom i], object[align=bottom i] {
  594. vertical-align: bottom;
  595. }
  596. /* 15.5.4 The details and summary elements
  597. * https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements
  598. */
  599. details > summary:first-of-type {
  600. display: list-item;
  601. counter-increment: list-item 0;
  602. list-style: disclosure-closed inside;
  603. }
  604. details[open] > summary:first-of-type {
  605. list-style-type: disclosure-open;
  606. }
  607. /* 15.5.12 The marquee element
  608. * https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2
  609. */
  610. marquee {
  611. display: inline-block;
  612. text-align: initial;
  613. }
  614. /* 15.5.13 The meter element
  615. * https://html.spec.whatwg.org/multipage/rendering.html#the-meter-element-2
  616. */
  617. meter {
  618. appearance: auto;
  619. }
  620. /* 15.5.14 The progress element
  621. * https://html.spec.whatwg.org/multipage/rendering.html#the-progress-element-2
  622. */
  623. progress {
  624. appearance: auto;
  625. }
  626. /* https://www.w3.org/TR/mediaqueries-5/#descdef-media-inverted-colors
  627. */
  628. @media (inverted-colors) {
  629. img:not(picture>img),
  630. picture,
  631. video {
  632. filter: invert(100%);
  633. }
  634. }
  635. /* This is the same as default intrinsic size of a <progress> element */
  636. progress {
  637. width: 300px;
  638. height: 12px;
  639. }
  640. /* The default progress-value/bar CSS below is the same as Blink/WebKit.
  641. * Note: Setting any more than the backgrond-color may have unintended consequences, as sites don't expect to unset more than that.
  642. */
  643. progress::-webkit-progress-bar {
  644. width: inherit;
  645. height: inherit;
  646. background-color: grey;
  647. }
  648. progress::-webkit-progress-value {
  649. height: inherit;
  650. background-color: green;
  651. }