![]() |
#1 | |||
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Oct 2012
Device: Kindle, iPhone 3GS
|
What am I missing in using <span> for bold?
Using Sigil 0.6.1 for Mac. I've looked for this issue issue here and elsewhere, but can't find a clue...
I seem to be missing something in using <span> to make words bold. Here's the CSS: Quote:
Quote:
Using this HTML works fine: Quote:
Since I've completed coding the entire pub using the first span code, I'd rather not bloat the file using all the extra code in the second span example. I've checked the rest of the CSS to make certain I'm not accidentally clearing the style, but the odd thing is that the same thing, but for italics, works OK. What and I missing? Thanks! (I'll be out until this afternoon, so I'll check back in then.) zack |
|||
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,905
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You did remember to link THAT CSS to the HTML page?
Another common reason is there is an error elsewhere in the CSS that viewer like ADE will discard the whole CSS rather than just the selector. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Run the thing through the CSS check in Tools, Validate stylesheet and see if that helps catch any error.
BTW make sure you don't have any style commands at the top of this particular html document that cancels it out. This only likely if you brought it in from somebody else's document, like Hyperwar or other online document source. |
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Oct 2012
Device: Kindle, iPhone 3GS
|
Just got back in. Thanks very much for the suggestions, the ducks and mrmikel. Gives me some things to check this evening. I'll report back with my results -- hopefuilly I find the cause.
zack |
![]() |
![]() |
![]() |
#5 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Just wondering...I haven't tried before...can you define a class with an element that is already reserved??
.b {font-weight:bold} when <b> is already reserved?? If it were me, I would do a S/R: Search: <span class="b">(.*?)</span> Replace: <strong>\1</strong> with: strong {font-weight:bold} That way you keep styling out of the document and in the css, and you don't need to bloat it with extra <spans>. Please let us know if you find the problem. Cheers, |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,905
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
But you can redefine b to be something else. As a test, it just made it font-size 150% instead of emphasized and it worked.
That is the beauty of CSS. You can fix a problem once in the stylesheet instead of 150 times in the text. And if you change your mind, another easy change to the stylesheet instead of 150 more corrections. Last edited by mrmikel; 03-22-2013 at 09:20 PM. |
![]() |
![]() |
![]() |
#8 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,905
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
.b {font-weight: 700} |
|
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
cool!
That kind of goes against my program-oriented background - being able to define a reserved tag as a user class (the difference between b and dot b). It certainly makes CSS more flexible. Although if I started doing that (using b and .b at the same time) I would probably confuse myself even more than I already do!! ![]() |
![]() |
![]() |
![]() |
#10 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Oct 2012
Device: Kindle, iPhone 3GS
|
Well, thanks for all the suggestions. Here are the results:
CSS is properly linked. There is only one style sheet. I created and have been the only one to work on the file, but that's not to say I didn't introduce errors. ADE shows the bolded words properly, but they did not show in Sigil Book View or Calibre preview. It seems that <span> for bolding is simply not displays properly in Sigil. The "bold" button works fine, but inserts the <b> code. Oddly enough, <span> works OK for italics. Late now, so I'll take a closer look in the morning and do some more testing on when I'm fresh. |
![]() |
![]() |
![]() |
#11 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,905
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
<p class="p"> OMG </p> What is wrong with para, normal, indent, title (usually centered),chapter... ![]() |
|
![]() |
![]() |
![]() |
#12 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Oct 2012
Device: Kindle, iPhone 3GS
|
Using "b" is a little departure for me. Coming from a print background, I name typographic styles descriptive names so I can know what they do when I come back to a project a year later. Trying to save file space I guess.
I usually have been doing the same thing in CSS, like "anecdote-follow-nosp", etc. More bits but easier to work with, IMHO. I do need to do some more reading on "reserved" tags, though. As a designer, this programming stuff is fun but make my eyes hurt -- I have to work to think digitally, rather than visually! |
![]() |
![]() |
![]() |
#13 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Maybe <b> is not the best example, but take <em>. It's intended to mean emphasis and, although its default style is often italic, you could want to have some other style in a given document (bold, underlined, red, different font, letterspaced...). So, not only you can override default styles, but it's sometimes a good idea to re-define them, when it is important. For instance, I often use: Code:
em { font-style: italic; } em em { font-style: normal; } And you can even make a <div> behave as a <span> (display: inline) and vice-versa (display: block). But there are some XHTML restrictions that still apply (a <span> or a <p> cannot contain a <div>, for instance). Since <p> cannot contain <div>, I sometimes create a special class of <span> that behaves as <div>, and then <p> can contain this <span> ![]() |
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
If the bold shows in ADE but not in Sigil nor Calibre makes me think that you are using an older version of Sigil that still runs on Qt4. That version has some difficulties with fonts.
Never just trust solely on Sigil or Calibre to see how your book will look. ADE is much more representative. |
![]() |
![]() |
![]() |
#15 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Oct 2012
Device: Kindle, iPhone 3GS
|
Quote:
This discussion has given me some good idea about handling styles better.... |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
span in span: is this problematic? | tbuyus | ePub | 8 | 03-31-2013 08:01 AM |
Regex and span | JSWolf | Sigil | 7 | 01-23-2013 06:35 AM |
how do I span more than one line with regex | BartB | Sigil | 3 | 12-11-2011 05:12 PM |
Remove <br /> together with span, and only span | Razzia | Recipes | 3 | 05-30-2011 06:55 PM |
Re Entering Title in Bold or Bold And Colour Font | pricespringer | Library Management | 1 | 05-09-2011 04:45 AM |