Default.css 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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: sans-serif;
  7. color: -libweb-palette-base-text;
  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 -libweb-palette-threed-shadow1;
  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: scroll;
  35. }
  36. input[type=submit], input[type=button], input[type=reset], input[type=checkbox], input[type=radio] {
  37. border: none;
  38. min-width: unset;
  39. min-height: unset;
  40. width: unset;
  41. cursor: unset;
  42. }
  43. input::placeholder {
  44. color: rgb(117, 117, 117);
  45. }
  46. button, input[type=submit], input[type=button], input[type=reset] {
  47. padding: 1px 4px;
  48. background-color: -libweb-palette-button;
  49. border: 1px solid -libweb-palette-threed-shadow1;
  50. color: -libweb-palette-button-text;
  51. }
  52. button:hover, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover {
  53. background-color: -libweb-palette-hover-highlight;
  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: -libweb-link;
  200. }
  201. :visited {
  202. color: -libweb-palette-visited-link;
  203. }
  204. :link:active, :visited:active {
  205. color: -libweb-palette-active-link;
  206. }
  207. :link, :visited {
  208. text-decoration: underline;
  209. cursor: pointer;
  210. }
  211. :focus-visible {
  212. outline: auto;
  213. }
  214. mark {
  215. background: yellow;
  216. color: black;
  217. }
  218. /* this color is just a suggestion and can be changed based on implementation feedback */
  219. abbr[title], acronym[title] {
  220. text-decoration: dotted underline;
  221. }
  222. ins, u {
  223. text-decoration: underline;
  224. }
  225. del, s, strike {
  226. text-decoration: line-through;
  227. }
  228. q::before {
  229. content: open-quote;
  230. }
  231. q::after {
  232. content: close-quote;
  233. }
  234. /*
  235. NOTE: This isn't a real property and value. See https://github.com/whatwg/html/issues/2291
  236. br {
  237. display-outside: newline;
  238. }
  239. */
  240. /* this also has bidi implications */
  241. nobr {
  242. white-space: nowrap;
  243. }
  244. /*
  245. NOTE: This isn't a real property and value. See https://github.com/whatwg/html/issues/2291
  246. wbr {
  247. display-outside: break-opportunity;
  248. }
  249. */
  250. /* this also has bidi implications */
  251. nobr wbr {
  252. white-space: normal;
  253. }
  254. /* 15.3.5 Bidirectional text
  255. * https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering
  256. */
  257. [dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) {
  258. direction: ltr;
  259. }
  260. [dir]:dir(rtl), bdi:dir(rtl) {
  261. direction: rtl;
  262. }
  263. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  264. legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
  265. h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
  266. tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
  267. [dir=ltr i], [dir=rtl i], [dir=auto i] {
  268. unicode-bidi: isolate;
  269. }
  270. bdo, bdo[dir] {
  271. unicode-bidi: isolate-override;
  272. }
  273. input[dir=auto i]:is([type=search i], [type=tel i], [type=url i],
  274. [type=email i]), textarea[dir=auto i], pre[dir=auto i] {
  275. unicode-bidi: plaintext;
  276. }
  277. /* 15.3.6 Sections and headings
  278. * https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings
  279. */
  280. article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
  281. display: block;
  282. }
  283. h1 {
  284. margin-top: 0.67em;
  285. margin-bottom: 0.67em;
  286. font-size: 2.00em;
  287. font-weight: bold;
  288. }
  289. h2 {
  290. margin-top: 0.83em;
  291. margin-bottom: 0.83em;
  292. font-size: 1.50em;
  293. font-weight: bold;
  294. }
  295. h3 {
  296. margin-top: 1.00em;
  297. margin-bottom: 1.00em;
  298. font-size: 1.17em;
  299. font-weight: bold;
  300. }
  301. h4 {
  302. margin-top: 1.33em;
  303. margin-bottom: 1.33em;
  304. font-size: 1.00em;
  305. font-weight: bold;
  306. }
  307. h5 {
  308. margin-top: 1.67em;
  309. margin-bottom: 1.67em;
  310. font-size: 0.83em;
  311. font-weight: bold;
  312. }
  313. h6 {
  314. margin-top: 2.33em;
  315. margin-bottom: 2.33em;
  316. font-size: 0.67em;
  317. font-weight: bold;
  318. }
  319. :is(article, aside, nav, section) h1 {
  320. margin-top: 0.83em;
  321. margin-bottom: 0.83em;
  322. font-size: 1.50em;
  323. }
  324. :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  325. margin-top: 1.00em;
  326. margin-bottom: 1.00em;
  327. font-size: 1.17em;
  328. }
  329. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  330. margin-top: 1.33em;
  331. margin-bottom: 1.33em;
  332. font-size: 1.00em;
  333. }
  334. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  335. margin-top: 1.67em;
  336. margin-bottom: 1.67em;
  337. font-size: 0.83em;
  338. }
  339. :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 {
  340. margin-top: 2.33em;
  341. margin-bottom: 2.33em;
  342. font-size: 0.67em;
  343. }
  344. /* 15.3.7 Lists
  345. * https://html.spec.whatwg.org/multipage/rendering.html#lists
  346. */
  347. dir, dd, dl, dt, menu, ol, ul {
  348. display: block;
  349. }
  350. li {
  351. display: list-item;
  352. text-align: match-parent;
  353. }
  354. dir, dl, menu, ol, ul {
  355. margin-block-start: 1em;
  356. margin-block-end: 1em;
  357. }
  358. :is(dir, dl, menu, ol, ul) :is(dir, dl, menu, ol, ul) {
  359. margin-block-start: 0;
  360. margin-block-end: 0;
  361. }
  362. dd {
  363. margin-inline-start: 40px;
  364. }
  365. dir, menu, ol, ul {
  366. padding-inline-start: 40px;
  367. }
  368. ol, ul, menu {
  369. counter-reset: list-item;
  370. }
  371. ol {
  372. list-style-type: decimal;
  373. }
  374. dir, menu, ul {
  375. list-style-type: disc;
  376. }
  377. :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  378. list-style-type: circle;
  379. }
  380. :is(dir, menu, ol, ul) :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  381. list-style-type: square;
  382. }
  383. /* 15.3.8 Tables
  384. * https://html.spec.whatwg.org/multipage/rendering.html#tables-2
  385. */
  386. table {
  387. display: table;
  388. }
  389. caption {
  390. display: table-caption;
  391. }
  392. colgroup, colgroup[hidden] {
  393. display: table-column-group;
  394. }
  395. col, col[hidden] {
  396. display: table-column;
  397. }
  398. thead, thead[hidden] {
  399. display: table-header-group;
  400. }
  401. tbody, tbody[hidden] {
  402. display: table-row-group;
  403. }
  404. tfoot, tfoot[hidden] {
  405. display: table-footer-group;
  406. }
  407. tr, tr[hidden] {
  408. display: table-row;
  409. }
  410. td, th {
  411. display: table-cell;
  412. }
  413. colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
  414. tfoot[hidden], tr[hidden] {
  415. visibility: collapse;
  416. }
  417. table {
  418. box-sizing: border-box;
  419. border-spacing: 2px;
  420. border-collapse: separate;
  421. text-indent: initial;
  422. }
  423. td, th {
  424. padding: 1px;
  425. }
  426. th {
  427. font-weight: bold;
  428. /*
  429. The text-align property for table headings is non-standard, but all
  430. existing user-agents seem to render them centered by default.
  431. See:
  432. - https://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css?rev=295625#L272
  433. - https://searchfox.org/mozilla-central/rev/0b55b868c17835942d40ca3fedfca8057481207b/layout/style/res/html.css#473
  434. */
  435. text-align: center;
  436. }
  437. caption {
  438. text-align: center;
  439. }
  440. thead, tbody, tfoot, table > tr {
  441. vertical-align: middle;
  442. }
  443. tr, td, th {
  444. vertical-align: inherit;
  445. }
  446. thead, tbody, tfoot, tr {
  447. border-color: inherit;
  448. }
  449. table[rules=none i], table[rules=groups i], table[rules=rows i],
  450. table[rules=cols i], table[rules=all i], table[frame=void i],
  451. table[frame=above i], table[frame=below i], table[frame=hsides i],
  452. table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
  453. table[frame=box i], table[frame=border i],
  454. table[rules=none i] > tr > td, table[rules=none i] > tr > th,
  455. table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
  456. table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
  457. table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
  458. table[rules=all i] > tr > td, table[rules=all i] > tr > th,
  459. table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
  460. table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
  461. table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
  462. table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
  463. table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
  464. table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
  465. table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
  466. table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
  467. table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
  468. table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
  469. table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
  470. table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
  471. table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th,
  472. table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
  473. table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
  474. border-color: black;
  475. }
  476. /* 15.3.10 Form controls
  477. * https://html.spec.whatwg.org/multipage/rendering.html#form-controls
  478. */
  479. input, select, button, textarea {
  480. letter-spacing: initial;
  481. word-spacing: initial;
  482. line-height: initial;
  483. text-transform: initial;
  484. text-indent: initial;
  485. text-shadow: initial;
  486. appearance: auto;
  487. }
  488. input, select, textarea {
  489. text-align: initial;
  490. }
  491. input:is([type=reset i], [type=button i], [type=submit i]), button {
  492. text-align: center;
  493. }
  494. input, button {
  495. display: inline-block;
  496. }
  497. input[type=hidden i], input[type=file i], input[type=image i] {
  498. appearance: none;
  499. }
  500. input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i],
  501. [type=submit i], [type=color i], [type=search i]), select, button {
  502. box-sizing: border-box;
  503. }
  504. textarea {
  505. white-space: pre-wrap;
  506. }
  507. /* 15.3.11 The hr element
  508. * https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
  509. */
  510. hr {
  511. color: gray;
  512. border-style: inset;
  513. border-width: 1px;
  514. margin-block-start: 0.5em;
  515. margin-inline-end: auto;
  516. margin-block-end: 0.5em;
  517. margin-inline-start: auto;
  518. overflow: hidden;
  519. }
  520. /* 15.3.12 The fieldset and legend elements
  521. * https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements
  522. */
  523. fieldset {
  524. display: block;
  525. margin-inline-start: 2px;
  526. margin-inline-end: 2px;
  527. border: groove 2px ThreeDFace;
  528. padding-block-start: 0.35em;
  529. padding-inline-end: 0.75em;
  530. padding-block-end: 0.625em;
  531. padding-inline-start: 0.75em;
  532. min-inline-size: min-content;
  533. }
  534. legend {
  535. padding-left: 2px;
  536. padding-right: 2px;
  537. }
  538. legend[align=left i] {
  539. justify-self: left;
  540. }
  541. legend[align=center i] {
  542. justify-self: center;
  543. }
  544. legend[align=right i] {
  545. justify-self: right;
  546. }
  547. /* 15.4.1 Embedded content
  548. * https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules
  549. */
  550. iframe {
  551. border: 2px inset;
  552. }
  553. video {
  554. object-fit: contain;
  555. }
  556. /* 15.4.3 Attributes for embedded content and images
  557. * https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
  558. */
  559. iframe[frameborder='0'], iframe[frameborder=no i] { border: none; }
  560. embed[align=left i], iframe[align=left i], img[align=left i],
  561. input[type=image i][align=left i], object[align=left i] {
  562. float: left;
  563. }
  564. embed[align=right i], iframe[align=right i], img[align=right i],
  565. input[type=image i][align=right i], object[align=right i] {
  566. float: right;
  567. }
  568. embed[align=top i], iframe[align=top i], img[align=top i],
  569. input[type=image i][align=top i], object[align=top i] {
  570. vertical-align: top;
  571. }
  572. embed[align=baseline i], iframe[align=baseline i], img[align=baseline i],
  573. input[type=image i][align=baseline i], object[align=baseline i] {
  574. vertical-align: baseline;
  575. }
  576. embed[align=texttop i], iframe[align=texttop i], img[align=texttop i],
  577. input[type=image i][align=texttop i], object[align=texttop i] {
  578. vertical-align: text-top;
  579. }
  580. embed[align=absmiddle i], iframe[align=absmiddle i], img[align=absmiddle i],
  581. input[type=image i][align=absmiddle i], object[align=absmiddle i],
  582. embed[align=abscenter i], iframe[align=abscenter i], img[align=abscenter i],
  583. input[type=image i][align=abscenter i], object[align=abscenter i] {
  584. vertical-align: middle;
  585. }
  586. embed[align=bottom i], iframe[align=bottom i], img[align=bottom i],
  587. input[type=image i][align=bottom i], object[align=bottom i] {
  588. vertical-align: bottom;
  589. }
  590. /* 15.5.4 The details and summary elements
  591. * https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements
  592. */
  593. details > summary:first-of-type {
  594. display: list-item;
  595. counter-increment: list-item 0;
  596. list-style: disclosure-closed inside;
  597. }
  598. details[open] > summary:first-of-type {
  599. list-style-type: disclosure-open;
  600. }
  601. /* 15.5.12 The marquee element
  602. * https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2
  603. */
  604. marquee {
  605. display: inline-block;
  606. text-align: initial;
  607. }
  608. /* 15.5.13 The meter element
  609. * https://html.spec.whatwg.org/multipage/rendering.html#the-meter-element-2
  610. */
  611. meter {
  612. appearance: auto;
  613. }
  614. /* 15.5.14 The progress element
  615. * https://html.spec.whatwg.org/multipage/rendering.html#the-progress-element-2
  616. */
  617. progress {
  618. appearance: auto;
  619. }
  620. /* https://www.w3.org/TR/mediaqueries-5/#descdef-media-inverted-colors
  621. */
  622. @media (inverted-colors) {
  623. img:not(picture>img),
  624. picture,
  625. video {
  626. filter: invert(100%);
  627. }
  628. }
  629. /* This is the same as default intrinsic size of a <progress> element */
  630. progress {
  631. width: 300px;
  632. height: 12px;
  633. }
  634. /* The default progress-value/bar CSS below is the same as Blink/WebKit.
  635. * Note: Setting any more than the backgrond-color may have unintended consequences, as sites don't expect to unset more than that.
  636. */
  637. progress::-webkit-progress-bar {
  638. width: inherit;
  639. height: inherit;
  640. background-color: grey;
  641. }
  642. progress::-webkit-progress-value {
  643. height: inherit;
  644. background-color: green;
  645. }