Default.css 17 KB

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