skip to Main Content

Publishing an ebook, and the Kindle validation (in Kindle Previewer 3) fails because the conversion software adds a "class" attribute to the <html> tag.

The style only sets margins and padding to 0, which surely could be as easily done by redefining the html tag.

a) would it be safe to remove the attribute, and b) was it even necessary in the first place?

(I realise the answer should be very simple to find, but searching Google for the terms html, class, tag etc is only ever going to give me generic pages on writing html or CSS 🙁

<html xmlns="http://www.w3.org/1999/xhtml" class="calibre">

where .calibre { margin:0; padding:0;}

I would prefer <html xmlns="http://www.w3.org/1999/xhtml">

where html { margin:0; padding:0;}

2

Answers


  1. You know, the "class" attribute in the <html> tag is like a fancy hat at a casual picnic. It’s not necessary, but doesnt hurt either. Browsers don’t care about it, and the HTML specification doesn’t either.

    It’s like a quirky addition from the Kindle conversion software that tries to impose its default styles on your document.

    Here’s a simplified HTML code that will work just fine without that "class" attribute:

    If you want to apply some default styles, You can easily do that with the tag itself, this will achieve the same result as the "class" attribute:

    html {
      margin: 0;
      padding: 0;
    }
    
    Login or Signup to reply.
  2. try to use class attribute in body tag it work similar

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search