| 
			
			 | 
		#1 | 
| 
			
			
			
			 Addict 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 266 
				Karma: 2121470 
				Join Date: Oct 2011 
				Location: Arlington, TX 
				
				
				Device: Kindle PW4, Moon+ Reader on a cheap Android tablet 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Incomplete Live CSS in the editor
			 
			
			
			I am running Calibre 5.23 on Linux 
		
	
		
		
			Sometimes, when I have purchased a new ebook and am tweaking its formatting in the calibre editor, I will see situations where the "File preview" panel clearly shows some formatting "feature" that I want to change - such as big left and right margins - but the "Live CSS" panel will give no indication of the CSS rule causing this "feature" I can usually just read through the CSS and figure out where the formatting is coming from, but I encountered this issue in this month's Tor.com free ebook, so decided to post this and see what the real issue is. I have attached a small scrambled.epub file to this thread, which was built by deleting all the images and html files (except one) from this epub and then using the ScrambleEpub plugin to scramble the rest. If you open this file in the Calibre editor, and then open "introduction.xhtml", you should see, in the File Preview panel, that it has unusually large left and right margins. If you then click on any text in the editor, in the '<p class="TX">' class, you should see something like this in the "Live CSS" panel: Code: 
	Matched CSS rules for p @20 OEBPS/styles/stylesheet.css p.TX font-style: normal font-weight: normal margin-bottom: 0px margin-left: 0px margin-right: 0px margin-top: 0px text-align: justify text-decoration-line: none text-decoration-style: initial text-decoration-color: initial text-indent: 1.4em -------------------------- Computed final style font-style: normal font-weight: 400 margin-bottom: 0px margin-left: 0px margin-right: 0px margin-top: 0px text-align: justify text-decoration-color: rgb(0, 0, 0) text-decoration-line: none text-decoration-style: solid text-indent: 28px -------------------------- In fact, it is this CSS rule: Code: 
	div.body {
  margin: 0 5em 0 5em;
}
Last edited by Section8; 11-02-2021 at 10:08 PM. Reason: Indicate Calibre version, platform  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Live CSS shows yout the css that applies to the element and the css that is inherited from parent elements. margin is not an inherited property. If you specify a margin ona  parent element, child elements dont get that margin also applied to them. It is true that visually it "looks like" the margin is applied to the child, but that's not actually the case.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,688 
				Karma: 9500498 
				Join Date: Sep 2021 
				Location: Australia 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			The margins are being set by <div class="body"> at the top of the page 
		
	
		
		
		
		
		
		
		
		
		
		
	
	The CSS rule is as follows which is setting Code: 
	div.body {
  margin: 0 5em 0 5em;
}
 | 
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| CSS support in the editor | vFbjgBDhV | Editor | 5 | 11-03-2020 10:25 AM | 
| Some css are automatically removed by Editor | nqk | Editor | 6 | 07-20-2020 02:32 AM | 
| Calibre editor e-reader html statusbar popup with css | ni_cc | Editor | 5 | 03-15-2020 09:36 AM | 
| a-z css editor solution | rjwse@aol.com | Editor | 4 | 04-07-2018 02:09 PM | 
| Tweak epub and Simple CSS Editor | Shadowman123 | Calibre | 11 | 09-30-2010 11:07 AM |