View Single Post
Old 03-27-2015, 08:27 PM   #1
hikerguy
Member
hikerguy began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Mar 2015
Device: Kindle
Help with stylesheets in Calibre

I'm still learning Calibre and have very minimal knowledge of stylesheets. My take on css styles is that they kind of work like Word's Styles. With Word's Styles, you assign attributes (like Heading1, Heading2 etc.) and any text that has, say, Heading1 applied to it can be changed "en masse" by changing the Heading1 attributes. Am I somewhat close on this?

My issue right now is I'm cleaning up a lot of the "garbage" that Calibre brings into the book when it's first converted for editing (e.g. <p class="xxxxx" </p>.

I noticed during the course of my cleanup that I seemed to have blown out all of the info in the stylesheet.css. I tried adding one piece of info to it as a test. So, here's what's in the titlpage.xhtml file:

====================

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
@page {
padding: 0;
margin: 0;
}
body {
text-align: center;
padding: 0;
margin: 0;
<link rel="stylesheet" href="stylesheet.css">
</style>
</head>

<body>

<div>

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 1200 1600" preserveAspectRatio="none">
<image width="1200" height="1600" xlink:href="cover_image.jpg"/>
</svg>

</div>

</body>

</html>

=====================


As I was playing around, I added the following line to the above:

<link rel="stylesheet" href="stylesheet.css">

I then went into the stylesheet.css and added this line:

p {
color: green;
}


I expected all of my text with the paragraph tag to turn green, but they didn't. What am I doing wrong here?

Ultimately, I want to create a stylesheet so I can tweak the heading, body, paragraph, etc. tags. Can someone help with this, or should I break down and learn HTML before I attempt to edit the html? I don't need to make major changes, so I'm hoping I can just get by with minimal html/css knowledge. I can look at basic html info and pretty figure out what's going on. CSS is new to me though.

Thanks,

Andy
hikerguy is offline   Reply With Quote