Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Realm Works Forums > Realm Works Discussion

Notices

Reply
 
Thread Tools Display Modes
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2017, 07:02 AM
Quote:
Originally Posted by tmilktoast View Post
Regarding those Edge of the Empire fonts, I imagine none of you are seeing them in your browser because you probably don't have them installed on your PC.

EightBitz, do you still want me to send you those things you asked for, or were you just going to work on Parody's suggestions?
Hey, here's something you might find interesting. Remember how there are two types of bulleted lists? One of them isn't actually formatted as a bulleted list. It just throws in a wingdings bullet followed by text.

*Shakes finger at Rob*
EightBitz is offline   #81 Reply With Quote
tmilktoast
Junior Member
 
Join Date: Jun 2014
Location: Wisconsin, USA
Posts: 17

Old January 27th, 2017, 07:14 AM
I've been meaning to make a post asking about these somewhat competing formatting options under Paragraph and Styles.
tmilktoast is offline   #82 Reply With Quote
tmilktoast
Junior Member
 
Join Date: Jun 2014
Location: Wisconsin, USA
Posts: 17

Old January 27th, 2017, 07:15 AM
Quote:
Originally Posted by EightBitz View Post
I'm working on Parody's suggestion, and I'm pretty far along with the div tags. Had a few hiccups along the way, but things are going well now.
Good to hear.
tmilktoast is offline   #83 Reply With Quote
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2017, 07:34 AM
CSS question for Parody or anyone who's willing to answer. Regarding the following divisions, is there, generally speaking, a preferred order they should be listed in the CSS file, or does it not matter?

.snippet TABLE {}
.snippet TABLE TR {}
.snippet TABLE TR TD {}
.snippet TABLE TR TD P {}
EightBitz is offline   #84 Reply With Quote
Parody
Senior Member
 
Join Date: Jan 2013
Location: Rochester, MN
Posts: 1,473

Old January 27th, 2017, 09:44 AM
Practically: the order doesn't matter for what you're doing here. I generally do the same thing as your example for those sorts of selectors.

Technically: there's an order of precedence and specificity that determines what order CSS rules are applied to matching elements; rules with higher precedence and/or more specificity override earlier ones. Order of appearance in an external CSS file only matters if two selectors have identical precedence and specificity.


Last edited by Parody; January 27th, 2017 at 09:50 AM.
Parody is offline   #85 Reply With Quote
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2017, 10:31 AM
Quote:
Originally Posted by Parody View Post
Practically: the order doesn't matter for what you're doing here. I generally do the same thing as your example for those sorts of selectors.

Technically: there's an order of precedence and specificity that determines what order CSS rules are applied to matching elements; rules with higher precedence and/or more specificity override earlier ones. Order of appearance in an external CSS file only matters if two selectors have identical precedence and specificity.
I thought that in that order of precedence, inline formatting always took precedence. But that doesn't seem to be the case. With tmilktoast's output, it has the following line (just including the relevant portion):

Code:
<td class="RWSnippet" style="background-color:#8B0000;...
That's kind of a rusty, reddish color. In my CSS file, I have the following elements (again, just including the relevant portions):

Code:
.snippet {--main-background-color:white;}
.snippet P {background-color:var(--main-background-color);}
.snippet TABLE {background-color:var(--main-background-color);}
.snippet TABLE TR {background-color:var(--main-background-color);}
.snippet TABLE TR TD {background-color:var(--main-background-color);}
.snippet TABLE TR TD P {background-color:var(--main-background-color);}
When I opened the html file, the background for the text in the table was white. Working my way up from TABLE TR TD P, I commented out each background-color in turn, and when I commented out the one for .snippet P, I saw the proper color in the table.

In the TABLE TR TD P section, I had him change the background-color to transparent, and that worked.

So that was unexpected ... to me anyway. Like I said, I'm still learning. :-)
EightBitz is offline   #86 Reply With Quote
kbs666
Senior Member
 
Join Date: Oct 2014
Location: Chicago, IL
Posts: 1,690

Old January 27th, 2017, 12:59 PM
Was the it rendered white or was the code fore the element color white? If it was just rendered white that could be a browser thing. Different browsers handle CSS differently.

my Realm Works videos
https://www.youtube.com/channel/UCZU...4DwXXkvmBXQ9Yw
kbs666 is offline   #87 Reply With Quote
Parody
Senior Member
 
Join Date: Jan 2013
Location: Rochester, MN
Posts: 1,473

Old January 27th, 2017, 02:21 PM
There's a <p> inside of an element with "snippet" as one of its classes, which matches your ".snippet p" selector. It doesn't matter how deep the containment hierarchy goes:
Code:
<div class="snippet">
  <p>This matches.</p>
  <div class="whatever">
    <p>As does this.</p>
    <table><tr><td><p>And this too.</p></td></tr></table>
  </div>
</div>
<p>But not this.</p>
That particular <p> should also match ".snippet table tr td p". ".snippet table tr td p" is more specific than ".snippet p", so ".snippet p" should be applied first, then ".snippet table tr td p". The inline style would have precedence if it was on the <p>, but it's not; it's on a <td> that happens to contain a <p>, and both of the selectors that match the <p> also set the background-color.

Let's take a step back. Your goal is to not have a background-color for the text in the cell and let the cell's background-color show through. The term for that for background-colors is "transparent". It's also the default, which is usually specified in CSS with "initial". Something like this might work for you:

Code:
.snippet {
  background-color: white;
}

.snippet p { /* default formatting for regular paragraphs */ }

.snippet table { /* default table formatting */ }

.snippet table p {
  /* reset the background color */
  background-color: transparent;
}
This doesn't do much by itself, but if you do specify a different background-color for a <table> or <tr> or <td> or whatever and they happen to contain <p>s, then hopefully this will make it do what you actually want.

Note that this is only needed because something is overriding the default. If your ".snippet p" selector doesn't include a background-color, then you don't need to override it for tables containing <p>s. The less you specify, the better. :)

FWIW, if you want a selector that means "only <p>s directly contained inside an element with the 'snippet' class", you could try try ".snippet + p". Also you don't need to use <p>s inside of <td>s or <th>s, so if there's only one <p> in a cell or header you could strip it.


Last edited by Parody; January 27th, 2017 at 02:25 PM.
Parody is offline   #88 Reply With Quote
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2017, 04:06 PM
Quote:
Originally Posted by Parody View Post
There's a <p> inside of an element with "snippet" as one of its classes, which matches your ".snippet p" selector. It doesn't matter how deep the containment hierarchy goes:
Code:
<div class="snippet">
  <p>This matches.</p>
  <div class="whatever">
    <p>As does this.</p>
    <table><tr><td><p>And this too.</p></td></tr></table>
  </div>
</div>
<p>But not this.</p>
That particular <p> should also match ".snippet table tr td p". ".snippet table tr td p" is more specific than ".snippet p", so ".snippet p" should be applied first, then ".snippet table tr td p". The inline style would have precedence if it was on the <p>, but it's not; it's on a <td> that happens to contain a <p>, and both of the selectors that match the <p> also set the background-color.

Let's take a step back. Your goal is to not have a background-color for the text in the cell and let the cell's background-color show through. The term for that for background-colors is "transparent". It's also the default, which is usually specified in CSS with "initial". Something like this might work for you:

Code:
.snippet {
  background-color: white;
}

.snippet p { /* default formatting for regular paragraphs */ }

.snippet table { /* default table formatting */ }

.snippet table p {
  /* reset the background color */
  background-color: transparent;
}
This doesn't do much by itself, but if you do specify a different background-color for a <table> or <tr> or <td> or whatever and they happen to contain <p>s, then hopefully this will make it do what you actually want.

Note that this is only needed because something is overriding the default. If your ".snippet p" selector doesn't include a background-color, then you don't need to override it for tables containing <p>s. The less you specify, the better. :)

FWIW, if you want a selector that means "only <p>s directly contained inside an element with the 'snippet' class", you could try try ".snippet + p". Also you don't need to use <p>s inside of <td>s or <th>s, so if there's only one <p> in a cell or header you could strip it.
Yep, that's exactly how I fixed it for him. Then he has to go and ask if it's possible to extract the images and such instead of leaving them embedded.

So guess what I've been working on... That's the thanks I get for helping him out. Jerk. ;-p
EightBitz is offline   #89 Reply With Quote
Parody
Senior Member
 
Join Date: Jan 2013
Location: Rochester, MN
Posts: 1,473

Old January 27th, 2017, 06:43 PM
Yeah, that's a little bit more of a pain. I've been working on a tool to unpack MHT files (think "web site saved as an email with attachments") which has to deal with the same thing.

Parody is offline   #90 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:54 AM.


Powered by vBulletin® - Copyright ©2000 - 2022, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.