Quote:
Originally Posted by DNSB
Perhaps an automated fix for those books where the p tag setup in the stylesheet includes "font-size: 1em;" and then every blasted paragraph has a <p><span class="block2"> and in the stylesheet, block2 has "font-size: 1em;" as it's only entry.
My issue with cleaning stylesheets with the calibre editor is that at time, it's removal of unused css gets too efficient when someone has gotten too cute with their css. The type of stylesheet where you have to parse multiple entries with a lot of them involving media queries and a love for ::.
|
I've seen a number of Kindle eBooks where there are just way way too many media queries.
Here's some CSS from a Kindle eBook made with Vellum. It's one of two CSS files. This one is just media queries. It's terrible.
Code:
/*
* THREE LITTLE PIGS
* Stylesheet generated by Vellum
*/
@media not amzn-mobi {
p span.last-word, li span.lastword {
-webkit-hyphenate-limit-after: 7;
}
}
@media not amzn-mobi {
.element .section-title {
font-size: 100%;
}
}
@media not amzn-mobi {
span.monospace, span.monospace b {
font-family: Courier, monospace;
}
}
@media not amzn-mobi {
span.sans-serif, span.sans-serif b {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
}
@media screen and (max-width: 420px) {
ul, ol {
padding-right: 0px;
}
}
@media screen and (max-width: 420px) {
blockquote.verse {
padding-left: 1.5em;
padding-right: 1.5em;
}
}
@media all {
span.last-word-with-trailing-em-dash {
white-space: nowrap;
}
}
@media not amzn-mobi {
a, a * {
color: rgb(36, 39, 116);
}
}
@media all{
div a.link-contains-image {
text-decoration: none !important;
}
}
@media not amzn-mobi {
.element .section-title {
margin-top: 1.4em;
padding-top: 0.7em;
padding-bottom: 0.7em;
margin-bottom: 0px;
}
}
@media not amzn-mobi {
blockquote p {
hyphens: manual;
adobe-hyphenate: none;
-webkit-hyphens: manual;
}
}
@media screen and (max-width: 420px) {
p.blockquote-attribution {
margin-left: 0em;
}
}
@media not amzn-mobi {
.element-bodymatter .text > .implicit-break {
margin-top: 0px;
height: 1.4em;
margin-bottom: 1.4em;
clear: both;
}
}
@media not amzn-mobi {
blockquote.prose.keep-lines-on-same-page p, blockquote.verse.keep-lines-on-same-page .stanza, blockquote.keep-lines-on-same-page .paragraph-and-attribution, div.alignment-block.keep-lines-on-same-page .text-block, ul.keep-lines-on-same-page, ol.keep-lines-on-same-page {
page-break-inside: avoid;
}
}
@media not amzn-mobi {
.alignment-block, blockquote, .ornamental-break, .section-title .endnotes {
clear: both;
}
}
@media not amzn-mobi {
img.low-res {
display: none;
}
}
@media screen and (max-height: 580px) {
.element-type-dedication.element-without-heading {
margin-top: 7em;
}
}
@media screen and (max-height: 580px) {
.element-type-epigraph.element-without-heading {
margin-top: 7em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-dedication p, .element-container-single.element-type-epigraph p {
hyphens: manual;
adobe-hyphenate: none;
-webkit-hyphens: manual;
}
}
@media not amzn-mobi {
.element-container-single.element-type-also-by .heading {
min-height: inherit;
}
}
@media not amzn-mobi {
.element-container-single.element-type-also-by .heading .title-subtitle-block, .element-container-single.element-type-also-by .heading .title-subtitle-block .title-block, .element-container-single.element-type-also-by .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-also-by .heading .heading-contents {
padding-top: 2em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-blurbs .heading {
min-height: inherit;
}
}
@media not amzn-mobi {
.element-container-single.element-type-blurbs .heading .title-subtitle-block, .element-container-single.element-type-blurbs .heading .title-subtitle-block .title-block, .element-container-single.element-type-blurbs .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-blurbs .heading .heading-contents {
padding-top: 2em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-endnotes .heading {
min-height: inherit;
}
}
@media not amzn-mobi {
.element-container-single.element-type-endnotes .heading .title-subtitle-block, .element-container-single.element-type-endnotes .heading .title-subtitle-block .title-block, .element-container-single.element-type-endnotes .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-endnotes .heading .heading-contents {
padding-top: 2em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-also-by .heading .title-block, .element-container-single.element-type-blurbs .heading .title-block {
font-size: 90%;
}
}
@media not amzn-mobi {
.element-container-single.element-type-also-by .subhead {
text-align: center;
}
}
@media screen and (max-height: 580px) {
p.also-by-content {
margin-bottom: 0.25em;
}
}
@media not amzn-mobi {
.element-type-blurbs blockquote {
page-break-inside: avoid;
}
}
@media not amzn-mobi {
.element-type-toc .toc-contents {
padding-left: 5%;
padding-right: 5%;
}
}
@media screen and (max-width: 420px) {
.element-type-toc .toc-contents {
padding-left: 0%;
padding-right: 0%;
}
}
@media not amzn-mobi {
.element-type-toc div.toc-heading {
margin-left: 6%;
margin-right: 6%;
}
}
@media not amzn-mobi {
.element-type-toc h1.toc-title {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
}
@media not amzn-mobi {
.element-type-toc p {
text-align: left;
hyphens: none;
adobe-hyphenate: none;
-webkit-hyphens: none;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item {
page-break-inside: avoid;
}
}
@media not amzn-mobi {
.element-type-toc .item-number {
font-size: 80%;
padding-right: 0.3em;
text-indent: 0px;
padding-left: 0px;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item-element-type-part .item-number {
font-size: 70%;
}
}
@media not amzn-mobi {
.element-type-toc .item-children {
margin-left: 1.5rem;
margin-bottom: 0.5em;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item.has-no-children .item-title {
text-indent: -1.5rem;
padding-left: 1.5rem;
}
}
@media not amzn-mobi {
.element-type-toc .toc-frontmatter-group {
margin-bottom: 0.75em;
}
}
@media not amzn-mobi {
.element-type-toc .toc-backmatter-group {
margin-top: 0.75em;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item-element-type-volume.has-children {
margin-top: 0.75em;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item.has-author {
margin-bottom: 0.5em;
}
}
@media not amzn-mobi {
.element-type-toc p {
font-size: 90%;
}
}
@media not amzn-mobi {
.element-type-toc .item-author, .element-type-toc .item-subtitle {
font-size: 75%;
margin-top: 0.1em;
}
}
@media not amzn-mobi {
.element-type-toc .toc-item.has-leading-number .item-author, .element-type-toc .toc-item.has-leading-number .item-subtitle {
margin-left: 1.5rem;
}
}
@media not amzn-mobi {
.element-type-toc .item-subtitle {
font-style: italic;
}
}
@media not amzn-mobi {
.element-container-single.element-type-about-author .heading {
min-height: 6em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-about-author .heading .title-subtitle-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .title-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-about-author .heading .heading-contents {
padding-top: 3em;
}
}
@media screen and (max-height: 580px) {
.element-container-single.element-type-about-author .heading {
min-height: 4em;
}
}
@media screen and (max-height: 580px) {
.element-container-single.element-type-about-author .heading .title-subtitle-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .title-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media screen and (max-height: 580px) {
.element-container-single.element-type-about-author .heading .heading-contents {
padding-top: 1.25em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-about-author .heading-without-image .title-subtitle-block {
min-height: 0px;
margin-top: 0px;
margin-bottom: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-about-author p, .element-container-single.element-type-about-author li {
font-size: 90%;
}
}
@media not amzn-mobi {
.social-media-profiles .social-profile a {
text-decoration: none !important;
}
}
@media not amzn-mobi {
.social-media-profiles .social-profile .social-profile-image {
height: auto;
}
}
@media not amzn-mobi {
.social-media-profiles .social-profile .social-profile-image {
width: 1.8em;
}
}
@media not amzn-mobi {
.social-media-profiles.as-icons .social-profile {
display: inline;
padding-left: 0.05em;
padding-right: 0.05em;
}
}
@media all{
.social-media-profiles.as-icons .social-profile {
padding-left: 0.15em;
padding-right: 0.15em;
}
}
@media not amzn-mobi {
.element-type-copyright ul {
margin-top: 0.5em;
}
}
@media not amzn-mobi {
.element-container-single.element-type-copyright .heading {
min-height: inherit;
}
}
@media not amzn-mobi {
.element-container-single.element-type-copyright .heading .title-subtitle-block, .element-container-single.element-type-copyright .heading .title-subtitle-block .title-block, .element-container-single.element-type-copyright .heading .title-subtitle-block .element-number-block {
padding-top: 0px;
}
}
@media not amzn-mobi {
.element-container-single.element-type-copyright .heading .heading-contents {
padding-top: 2em;
}
}
@media screen and (max-height: 580px) {
.element-type-copyright.element-without-heading {
margin-top: 1em;
}
}
@media not amzn-mobi {
.element-type-copyright .created-with-vellum {
padding-top: 0.5em;
}
}
@media not amzn-mobi {
.element-type-copyright .created-with-vellum a {
text-decoration: none !important;
}
}
@media not amzn-mobi {
.element-type-copyright .created-with-vellum-text {
font-size: 80%;
}
}
@media not amzn-mobi {
.element-type-copyright .created-with-vellum-text {
color: rgb(51, 51, 51);
}
}
@media not amzn-mobi {
div.title-page .title-page-title-subtitle-block, section.title-page .title-page-title-subtitle-block {
margin-left: 6%;
margin-right: 6%;
}
}
@media screen and (min-height: 720px) {
div.title-page-contributor-block {
margin-bottom: 3em;
}
}
@media screen and (min-height: 720px) {
.titlepage-several-secondary-contributors div.title-page-contributor-block {
margin-bottom: 2em;
}
}
@media screen and (max-height: 640px) {
div.title-page-title-subtitle-block {
min-height: 100px;
margin-top: 80px;
}
}
@media screen and (max-height: 640px) {
div.title-page-contributor-block {
min-height: 60px;
}
}
@media screen and (max-height: 580px) {
div.title-page-title-subtitle-block {
min-height: 80px;
margin-top: 80px;
}
}
@media screen and (max-height: 580px) {
div.title-page-contributor-block {
min-height: 3em;
}
}
@media screen and (max-height: 420px) {
div.title-page-title-subtitle-block {
min-height: 2em;
margin-top: 2em;
}
}
@media not amzn-mobi {
.titlepage-several-primary-contributors .title-page-contributor {
font-size: 90%;
}
}
@media not amzn-mobi {
.titlepage-several-primary-contributors .title-page-contributor-without-introduction {
display: inline-block;
padding-left: 0.5em;
padding-right: 0.5em;
}
}
@media not amzn-mobi {
.titlepage-several-secondary-contributors span.title-page-contributor-introduction {
display: inline;
}
}
@media not amzn-mobi {
img.title-page-publisher-logo-image {
width: 100%;
height: auto;
vertical-align: middle;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
h1.title-page-title {
font-size: 110%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
h2.title-page-subtitle {
font-size: 90%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
h2.title-page-contributor-primary {
font-size: 100%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
h2.title-page-contributor-secondary {
font-size: 90%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.titlepage-several-primary-contributors .title-page-contributor {
font-size: 80%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.titlepage-several-primary-contributors .title-page-contributor-without-introduction {
padding-left: 0.4em;
padding-right: 0.4em;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
h2.title-page-publisher {
font-size: 70%;
}
}
@media not amzn-mobi {
div.title-page, section.title-page {
margin-right: 2%;
margin-left: 2%;
}
}
@media not amzn-mobi {
div.title-page-publisher-logo-block.title-page-publisher-logo-aspect-wide {
width: 32%;
}
}
@media not amzn-mobi {
div.title-page-publisher-logo-block.title-page-publisher-logo-aspect-square {
width: 36.5%;
}
}
@media not amzn-mobi {
div.title-page-publisher-logo-block.title-page-publisher-logo-aspect-tall {
width: 48%;
}
}
@media not amzn-mobi {
.element .section-title {
font-family: Quicksand, sans-serif;
font-weight: 400;
}
}
@media not amzn-mobi {
.element-container-group .heading {
margin-bottom: 3em;
}
}
@media screen and (max-height: 580px) {
.element-container-group .heading {
margin-bottom: 2em;
}
}
@media not amzn-mobi {
.element-container-group .heading {
min-height: 15em;
}
}
@media not amzn-mobi {
.element-container-group .heading .heading-contents {
padding-top: 4em;
}
}
@media screen and (max-height: 580px) {
.element-container-group .heading {
min-height: 11em;
}
}
@media screen and (max-height: 580px) {
.element-container-group .heading .heading-contents {
padding-top: 3em;
}
}
@media not amzn-mobi {
img.heading-image-image {
width: 100%;
height: auto;
}
}
@media not amzn-mobi {
.element-container-group .heading {
margin-left: 6%;
margin-right: 6%;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-group .heading .title {
font-size: 150%;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-group .heading .element-number {
font-size: 130%;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-group .heading .subtitle {
margin-top: 1.3em;
margin-bottom: 1.5em;
font-size: 100%;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-group .heading .author {
margin-top: 1.3em;
margin-bottom: 1.5em;
font-size: 120%;
text-align: center;
text-transform: uppercase;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.element-container-group .heading .title {
font-size: 110%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.element-container-group .heading .element-number {
font-size: 100%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.element-container-group .heading .subtitle {
font-size: 90%;
}
}
@media screen and (max-height: 580px), screen and (max-width: 420px) {
.element-container-group .heading .author {
font-size: 100%;
}
}
@media not amzn-mobi {
.element-container-group .heading-image-block {
display: block;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-group .heading-image-block-before-heading-number {
margin-bottom: 2em;
}
}
@media not amzn-mobi {
.element-container-group .heading-image-block-after-heading-number {
margin-top: 1.5em;
margin-bottom: 1.3em;
}
}
@media not amzn-mobi {
.element-container-group .heading-image-block-after-title-and-subtitle {
margin-top: 1.5em;
}
}
@media not amzn-mobi {
.element-container-single .heading {
text-align: center;
margin-left: 6%;
margin-right: 6%;
}
}
@media not amzn-mobi {
.element-container-single .heading h1.title, .element-container-single .heading div.element-number, .element-container-single .heading h1.number-and-title, .element-container-single .heading h2.subtitle, .element-container-single .heading h2.author {
text-align: center;
}
}
@media not amzn-mobi {
.element-container-single .heading {
min-height: 12em;
}
}
@media not amzn-mobi {
.element-container-single .heading-without-image .heading-contents {
padding-top: 5em;
}
}
@media not amzn-mobi {
.element-container-single .heading-with-image .heading-contents {
padding-top: 2em;
}
}
@media screen and (max-height: 580px) {
.element-container-single .heading {
min-height: 10em;
}
}
@media screen and (max-height: 580px) {
.element-container-single .heading-without-image .heading-contents {
padding-top: 2.5em;
}
}
@media screen and (max-height: 580px) {
.element-container-single .heading-with-image .heading-contents {
padding-top: 1em;
}
}
@media not amzn-mobi {
.element-container-single .heading-image-block {
display: block;
text-align: center;
}
}
@media not amzn-mobi {
.element-container-single .heading-image-block-before-element-number {
margin-bottom: 2em;
}
}
@media not amzn-mobi {
.element-container-single .heading-image-block-after-element-number {
margin-top: 1.5em;
margin-bottom: 1.3em;
}
}
@media not amzn-mobi {
.element-container-single .heading-image-block-after-title-and-subtitle {
margin-top: 1.5em;
}
}
@media screen and (max-height: 580px) {
.element-container-single .heading-without-image .heading-contents {
padding-top: 3em;
}
}
@media screen and (max-height: 580px) {
.element-container-single .heading-with-image .heading-contents {
padding-top: 1em;
}
}
@media not amzn-mobi {
.element .heading .element-number, .element .heading .title, .element .heading .number-and-title, .element .heading .subtitle, .element .heading .author {
font-family: Quicksand, sans-serif;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 0.04em;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
}
@media not amzn-mobi {
.element-container-single .heading .subtitle {
font-size: 80%;
}
}
@media not amzn-mobi {
.element-container-single .heading .author {
font-size: 90%;
margin-top: 1.25em;
}
}
@media not amzn-mobi {
.element-container-group .heading .title {
letter-spacing: 0.05em;
margin-top: 0.4em;
}
}
@media not amzn-mobi {
.element-container-group .heading .subtitle {
margin-top: 1em;
margin-bottom: 1.5em;
}
}
@media not amzn-mobi {
.element-container-group .heading .author {
margin-top: 0.75em;
}
}
@media not amzn-mobi {
.element-type-volume .heading .element-number, .element-type-volume .heading .title-block-title-is-element-number .title, .element-type-volume .heading .title-block-without-element-number .title {
padding-bottom: 0.5em;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-bottom-style: solid;
}
}
@media not amzn-mobi {
.element-type-volume .heading .element-number, .element-type-volume .heading .title-block-title-is-element-number .title, .element-type-volume .heading .title-block-without-element-number .title {
border-top-color: rgb(102, 102, 102);
border-right-color: rgb(102, 102, 102);
border-bottom-color: rgb(102, 102, 102);
border-left-color: rgb(102, 102, 102);
}
}
@media not amzn-mobi {
.element-bodymatter .heading .element-number-block, .element-type-foreword .heading .element-number-block, .element-type-introduction .heading .element-number-block, .element-type-preface .heading .element-number-block, .element-type-afterword .heading .element-number-block, .element-type-acknowledgments .heading .element-number-block, .element-type-none .heading .element-number-block {
min-height: 1.5em;
}
}
@media not amzn-mobi {
.element-container-single .heading .element-number {
font-size: 90%;
}
}
@media not amzn-mobi {
.element-container-single .heading .title {
font-size: 110%;
}
}
@media not amzn-mobi {
.element-container-single .heading .subtitle {
margin-top: 0.75em;
}
}
@media not amzn-mobi {
.element-container-single .heading-image-block-after-element-number {
margin-top: 0.5em;
}
}
@media not amzn-mobi {
.element-container-single.element-bodymatter p.first-in-chapter::first-line, .element-container-single.element-bodymatter p.first-in-chapter span.first-phrase {
font-variant-numeric: normal;
font-variant: small-caps;
font-variant-alternates: normal;
font-variant-position: normal;
font-variant-east-asian: normal;
letter-spacing: 0.04em;
font-variant-ligatures: none;
hyphens: none;
adobe-hyphenate: none;
-webkit-hyphens: none;
}
}
@media not amzn-mobi {
.element-container-single.element-bodymatter p.first-in-section span.first-phrase {
font-family: Quicksand, sans-serif;
font-weight: 400;
text-transform: uppercase;
font-size: 97%;
letter-spacing: 0.03em;
hyphens: none;
adobe-hyphenate: none;
-webkit-hyphens: none;
}
}
@media not amzn-mobi {
div.ornamental-break-block {
width: 11.2em;
}
}
@media not amzn-mobi {
img.ornamental-break-image {
width: 100%;
height: auto;
vertical-align: top;
}
}
@media not amzn-mobi {
p.ornamental-break-as-text {
display: none;
}
}
@media not amzn-mobi {
.publisher-logo-width-500 {
width: 50%;
}
}
@media not amzn-mobi {
.ornamental-break-width-563 {
width: 56.3%;
}
}