As my screenshot below demonstrates I’ve gotten as far as I can with this little template and now need Sitepoint’s expertise to understand why my nth-child won’t consistently display its alternating row colors in any browser. I have bits of ronpat’s (and possibly Paul’s) solutions but apparently not all. This is a simple 12-row, 3-column template w/‘zebra’ striping. Thanks everyone.
p.s. re: tidying
If my blocked format offends, LEAVE THE THREAD. I’m doing this on a 3" cellphone screen with approximately >>1/8"<< of vertical typing-area visibility and what you see is what.you get. It took almost 1 hour just to get Sitepoint to accept my login with this p.o.s. phone so put a lid on it! Loathe though I am to encourage the use of these infernal smartphones to key in any code more complex than a 5-digit zip code, Sitepoint might want to think about incorporating a detectable ‘mobile’ interface into its architecture. Personally, I’d like to melt mine down and use it for a coaster. Just saying . . .
What’s the problem we are trying to solve here?
The rows do show in alternating colours like the first screen-shot in Firefox, Chrome and IE.
Or was it about something else?
Hey coot. Wellll . . . we’re supposed to be giving Tables the heave ho. Plus I like <DIV>s, they’re very elastic. I’m trying in my pathetic way to be (cough) modern. And aren’t tableless designs lighter on the coding? And give you groovy effects you can’t get with tables? Yes it’s a humble template but it has aspirations to be more!
I assume no responsibility for missing words and mangled spelling you see in my replies. I can’t see what I’m typing! That was “DIVs” before my phone mangled it; I like DIVs. And I was able to to render it in table format coot but I’ll download your code and compare it with mine.
Paul & Sam . . . I want to make sure I understand you:
You opened the TABLELESS version I uploaded to the beginning of my thread and you see the nth-child row colors in both Chrome and Explorer?
Then I’m trying to understand why I DON’T. It displays in Mozilla but nowhere else – including Dreamweaver 8, Nvu and RJ Editor. I’ve completely renamed it to avoid cache ghosting.
I’m on Windows 7 Pro 64-bit – are you seeing the rows in Windows 10? in Linux? on a Mac? I’ll revert my little project to tables but I’d appreciate the OS and browser versions you’re each using. Thanks.
Before you revert to a table, you might explain or demo what the contents of those cells will contain. Tabular data is text like one might find in a spreadsheet (I mention that because you are presently showing spreadsheet cell designations). In contrast, one should not use a table to frame a layout with paragraphs and images, ie. non-spreadsheet-like data. That would be the inappropriate use of a table.
About the alternating rows of color… Is there any other code in play that we do not see? It really sounds like their must be.
EDIT: I think you are using the library’s hardware, aren’t you? Since the yellow is very pale, I wonder if it might be interpreted as white in a system with limited color rendition. Try using one of the “web friendly” colors or just something more visible like #FFFF00.
Paul disregard the editors I’ve used. The page won’t display in either Chrome or IExplorer. I don’t know how many other ways I can say this. But I respect your privacy and won’t ask again. Perhaps someone else will share the test conditions in which they got it to work. For now I’m going to just stick with the code in my lead post and accept that it will render in Mozilla only.
Hi RP. No, I’m posting from The Cellphone From Hell. I’m coming up with workarounds however, and composing on an Android notepad which I then >>PASTE into the Sitepoint reply box. Pathetic, yes, but at least I can see what I’m typing!
Coot, you designed a completely different page! WTF? It’s ugly man! Nothing I design needs to be USDA Choice – I’m the only one who will ever see it. Sure, I’d like to know why 2 people can see my tableless version render accurately, but it’s no big deal. I just have to remember to open these little guys in Mozilla (it will be evident the minute I find myself looking at a pane of white heh).
It renders in Chromium (Chrome 77), and IE (11.765). It should be noted that both browsers are normalizing the tag output to remove all the unnecessary capitalization in both HTML and CSS components, but the file renders as expected.
OK, let’s stick with your original code for now and focus on the zebra stripes (alternating rows of colors).
Please change the yellowish background-color from “#ffffdb” to "#ffff00" which can also be written "yellow" (without the leading “#”).
Are the yellow stripes visible, or are they still missing?
Give descriptive feedback and post a copy of your revised code.
Assuming you are not talking about older versions of IE then as mentioned by everyone in this thread so far No matter their system the nth child striping is working fine.
This likely means the issue is your end in some way (cache maybe or perhaps different code or outdated browser).
The only way we can tell for sure is for you to put your code online so that we see exactly the same as you (you can do this in codepen if you have no online facility).
There obviously is an issue of sorts but it seems likely it is somewhere in your environment.
Are you not seeing stripes in the code that others have posted?