View Single Post
Old 01-30-2016, 04:22 PM   #1
KingAuthor
Member
KingAuthor began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jan 2016
Device: none
Unhappy Questions about SPAN and DIV using CSS

Hi, I'm at a bit of a standstill with my epub in Sigil. I suspect it's more tunnel vision than not. I'm about done with formatting my book in Sigil, however another problem has reared it's ugly head. I have 36 html sections and 3 external CSS. SS#1 is strictly for headings (H1,H2, etc.), SS#2 is for the majority of my paragraph styling (which is align:justified), and SS3 is only for sections that have all content centered. I did it this way to simplify things in my head. So, my problem deals with the last html section where I have SS1 and SS2 linked. Besides the header and paragraph content, I have a link at the bottom that I wanted centered on the page. I decided use SPAN to do inline styling without creating a line break, since it's just the one line. I added this to SS2:

}

span.link {
text-align: center;
}

And this to my code:

<p><a href="http://www.overmyheadwithCSS.com/gp/product/B016S96QEA">span class="link"><View on Headcase.com</span></a></p>

...and nothing changed. So I removed "span" from the "span.link" on CSS, thinking I was applying it wrong. But still no centered link. Then I used this:

}

div.link {
text-align: center;
}

and changed my code to:

<p><a href="http://www.overmyheadwithCSS.com/gp/product/B016S96QEA">div class="link"><View on Headcase.com</div></a></p>

and VIOLA! The link was centered! But now Sigil validation gives me this error:

element 'div' is not allowed for content model '(br|span|bdo|map|object|img|svg|tt|i|b|big|small| em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acrony m|sub|sup|input|select|textarea|label|button|ins|d el|script)'

I'm really new to this and it's been a crash course of bleary eyes and spontaneous profanity. I think this is a simple fix, but I'm too simple to understand? Shouldn't "span" work "inside" a style?
KingAuthor is offline   Reply With Quote