|  05-23-2014, 05:26 AM | #1 | 
| Bookish            Posts: 1,049 Karma: 2006208 Join Date: Jun 2011 Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11 |  Live CSS questions 
			
			Thanks for this new feature, very usefull.   2 questions: 
 | 
|   |   | 
|  05-23-2014, 05:28 AM | #2 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			1. It uses the same font as the editor 2. The values are whatever the preview panel reports them to be. If your font size is set to 30 odd pt then 1em ~ 36px | 
|   |   | 
| Advert | |
|  | 
|  05-23-2014, 06:00 AM | #3 | 
| Bookish            Posts: 1,049 Karma: 2006208 Join Date: Jun 2011 Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11 | 
			
			ehh, I indicated the "margin" setting (not font), which is nowhere changed but differs in the computed final style.
		 | 
|   |   | 
|  05-23-2014, 06:09 AM | #4 | 
| Wizard            Posts: 1,166 Karma: 1410083 Join Date: Nov 2010 Location: Germany Device: Sony PRS-650 | 
			
			Kovid, a very useful tool! Maybe one point for your help file: explain that @ 26 means at Line 26 in the editor. It took some time to recognize it and understand this helpful information. Last edited by Divingduck; 05-23-2014 at 06:44 AM. | 
|   |   | 
|  05-23-2014, 06:22 AM | #5 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | |
|   |   | 
| Advert | |
|  | 
|  05-23-2014, 06:25 AM | #6 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			@Divingduck: sure.
		 | 
|   |   | 
|  05-23-2014, 07:57 AM | #7 | 
| Color me gone            Posts: 2,089 Karma: 1445295 Join Date: Apr 2008 Location: Central Oregon Coast Device: PRS-300 | 
			
			It's worth noting that this function can be assigned a shortcut key which toggles under Edit Preferences, Keyboard Shortcuts, Windows. I think I don't need this on all the time, but it will sure be great when I am having a problem with something not displaying as I expect. (Which is too darn often!!) Thanks again, Kovid! I can see what Dr Chiper means. This is what it looks like on my machine. But I'm just glad to have it! | 
|   |   | 
|  05-23-2014, 10:46 AM | #8 | |
| Dead account. Bye            Posts: 587 Karma: 668244 Join Date: Mar 2011 Device: none | 
			
			HEY, GREAT JOB.  It has completely replaced the Inspector in my workflow as it also gives me the ability to directly jump to the place where the style is set... (And as I nearly never use Inspector capability about doing CSS test preview changes on the fly).    Nevertheless two veeeeeeeeeeery small suggestions: 
 As implied, Kovid, unimportant suggestions, only if you feel bored and have some free time... | |
|   |   | 
|  05-23-2014, 05:25 PM | #9 | 
| Dead account. Bye            Posts: 587 Karma: 668244 Join Date: Mar 2011 Device: none | 
			
			A double post but here I think that I've got some better suggestions and even a possible "bug". I upload a small test book (don't worry about its title, it's just the book I use for several testings) where I've been playing a little with styles... I don't know what the HTML/CSS/ePub specs actually say but it really seems that the priority of CSS styles is: 
 Well, I have two suggestions: 
 | 
|   |   | 
|  05-23-2014, 05:33 PM | #10 | |
| Dead account. Bye            Posts: 587 Karma: 668244 Join Date: Mar 2011 Device: none | Quote: 
 "em" measure units are relative. As example 4em means "4 times whatever base size you have". Because of that, in the end you need to convert them to "absolute" sizes. And that is what you are getting. The computed final size cannot be "em", it must be pixels. And remember that they are applied in cascade when inherited, they are NOT overridden in this case. If your base size is 15 pixels, your body is 2em and your h1 is 3em, you end with h1 being 90 pixels (15 x 2 x 3), not 45 pixels (15 x 3). But matched rules are still overridden. If h1 is still 3em but h1.myclass is 4em, you will end with 15 x 2 (from body) x 4 (from .myclass) = 120 pixels. 3em is not applied any more. Last edited by arspr; 05-23-2014 at 06:03 PM. | |
|   |   | 
|  05-23-2014, 07:22 PM | #11 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 Join Date: Mar 2012 Location: Sydney Australia Device: none | 
			
			I moved the Live CSS window under the file list, it would be nice if it used the same 'style' as the file list (font, background colour etc) More than happy to wait for 'full on' UI customisation. BR | 
|   |   | 
|  05-23-2014, 10:45 PM | #12 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			@arspr: CSS rule priority is more comples than that. http://www.w3.org/TR/css3-selectors/#specificity And yes, it is on my todo list to to indicate overriden properties. As for the order they are shown in, the order is not going to change, it will allways be style attirbute, rules matched from inline style tag, rules matched from included stylesheets (in the order they are included), inherited rules from ancestors. As for the font size, I am not sure I understand why you find the same font ok in the editor and too large in live css. I can probably add a config option to have live css use the geenral ui font instead of the editor font, but I am not going to add a separate font size control for it. | 
|   |   | 
|  05-24-2014, 03:49 AM | #13 | |||
| Dead account. Bye            Posts: 587 Karma: 668244 Join Date: Mar 2011 Device: none | Quote: 
 Quote: 
 In this way we have styles sorted by source rather than Inspector's priority Although, because of that, mrking overridden entries becomes much more critical. Glad to hear that it is in the ToDo list. Quote: 
 | |||
|   |   | 
|  05-24-2014, 04:51 AM | #14 | |
| Guru            Posts: 691 Karma: 3026110 Join Date: Dec 2008 Location: Lancashire, U.K. Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro + | Quote: 
 Another issue seems to be that the live css window has vertical scroll capability but not horizontal, meaning it isn't possible without maximising the window to read all of some longer lines. BobC | |
|   |   | 
|  05-24-2014, 07:29 AM | #15 | ||
| Dead account. Bye            Posts: 587 Karma: 668244 Join Date: Mar 2011 Device: none | Quote: 
 Could marking not only the overridden state but where it is being overridden possible? And a link to that overriding style? I mean something like this (as an idea): color: blue by .HiPriorityClass in whateverFile.css where the property would be stricken through, not underlined, (but I cannot do it in this Mobileread forum), and, of course, the last blue whateverFile.css would be a link to that position. Last edited by arspr; 05-24-2014 at 07:31 AM. | ||
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Questions about CSS and best practices | graycyn | ePub | 8 | 03-18-2012 04:15 PM | 
| External CSS file questions | michaelbr | Sigil | 10 | 01-27-2011 08:08 AM | 
| css pseudo elements and adjacent combinators in extra css? | ldolse | Calibre | 2 | 12-21-2010 05:09 PM | 
| a few extra css questions | marbs | Recipes | 12 | 11-20-2010 10:15 AM | 
| CSS Questions | JTAL604622 | Calibre | 0 | 11-18-2010 06:33 PM |