I'm not quite sure how to word it but I have a group of tags I want to style

nav->ul->li->a but I'm not sure what the syntax is to specify it I've tried just about every combination I can think of

current code:

<!DOCTYPE html>
    <title> Site One</title>
    <meta charset="UTF-8"/>
    .firststyle {
    .nstyle {
    backgroud-color: black;
    color: orange;
    nav,ul,li,a:link { color: orange; }
    <div class="firststyle">
    <h1> Site One</h1>
    <div class="nstyle">
        <ul style="list-style: none;">
            <li><a href="p_one.html">Page One</a></li>
            <li><a href="p_two.html">Page two</a></li>
    This is my testbed for HTML5/CSS and Javascript

Combinations I've tried:

nav > ul > li > a:link { color: orange; }

nav, ul, li, a:link { color: orange; }

nav.ul.li.a:link { color: orange; }

nav ul li a:link { color: orange; }

nav + ul + li + a:link { color: orange; }

Recommended Answers

All 4 Replies

Not sure what you want to make orange, but you have on line 18 a CSS block in another CSS block. That is not going to work.
Take it out of that CSS block.

.nstyle {
    backgroud-color: black;
    color: orange;

.nstyle nav a:link { color: orange; }

my understanding was that was a class and that sub blocks of CSS would work ? the intent was to make a class that would stylize the nav bar links ie change them to orange but I suppose that might not be possible?

If you want to nest CSS blocks, you will need to write your CSS with a CSS preprocessor like SASS or LESS.

oh wait, just noticed you did what I was looking for, didn't see the .nstyle class in front of the rest, guess it pays to do a double take ;p thanks, I wasn't aware you could add to the class outside the scope, coming from C++ CSS is pretty weird ;p thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.