title_body: Is there a detailed guide for creating an ebook for Kindle in HTML/CSS
upvoted_answer: Your best bet is to start with a solid epub file and run that through either KindleGen or Kindle Previewer. Other tools such as Sigil and Calibre are convenient, but often cause problems down the road by inserting their own bits of code. If you want to be certain that you know what is causing your problems, it's always best to do it yourself.
  
  The single best resource for creating a solid, valid epub file is the IDPF's epub 3.0 specification. Once you feel like you've gotten it pretty close, use epubcheck to find and iron out the kinks. A valid epub 3.0 file should transform seamlessly into a valid mobi/KF8. Once you have the valid epub, you can begin your Kindle-specific styling. Make sure you pay attention to the specific requirements of the Kindle Publishing Guidelines when you are doing so.
  
  For basic getting started guides, you might check out Harrison Ainsworth's "EPUB Format Construction Guide." It's a bit dated by now, and only deals with epub 2.0.1, but it will cover the basics pretty well. O'Reilly has a book on EPUB 3 Best Practices that's not too shabby, but it might go into more detail than you need to get started.
  
  Do a bit of reading, but not too much, and then find a non-DRM'ed epub file and tear it apart (just change the filename from .epub to .zip and unzip it) to see what makes it tick. Change stuff, re-zip is (how you do that will depend on the operating system you use) run it through epubcheck, and see what error messages you get. Getting a valid book is quite doable with minimal experience.
  
  As far as styling goes: there are lots of quirks in reading systems and devices. If you want to only do Kindle, you're cutting out a lot of potential issues, but each of Amazon's devices has its own quirks as well, so be prepared to test a lot, and ask lots of questions when problems come up.
  
  Best of luck!