Francois Rf
Francois Rf

Reputation: 27

CSS: How to select a tag inside an element?

So as my other question failed because I failed to post the right stuff.

My question is if there is a way to chosse tag inside an element... This is the xml file.

<?xml version="1.0" encoding="utf-8"?>
    <link rel="stylesheet" type="text/css" href="mystyle.css" media="screen"/> 
<mytest>
    <mystory>
        <myItem>
            <myDescription>Hello my name is <myName>Frosta</myName></myDescription>
        </myItem>
        <myItem>
            <myDescription>Hello my name is <myName>Frosti</myName></myDescription>
        </myItem>
    </mystory>
</mytest>

this is my css file :

myitem{
    color: green
}

myDescription{
    color: blue;
}

myName{
    color: red;
    
}

The problem is when I call the tag title or topicWord there's nothing that displays... And I would like to habe the title in blue and the topicWord in red...

What i tried :


element element

element+element

element1~element2

element>element

and it just dosn't work... It doesn't even show up...

EDIT: fixed a typo in the CSS file but it doesn't change my initial problem...

Upvotes: 0

Views: 156

Answers (2)

Benny Halperin
Benny Halperin

Reputation: 2332

You need to say

title {
    display: inline;
    color: blue;
}

because title element is display: none; by default. Note however, that it treats its content as text and shows explicitly.

Upvotes: 1

Web-Dev
Web-Dev

Reputation: 7

I ran your code through a jsfiddle, and I see that the title tag is not showing up, but if you remove the topicWord from within the title tag, it shows up fine, and is actually getting the styles changed fine. Why don't you put your title in an h2 tag, with a class of title? That way, it shows up, and you can do this for your css:

.title{color: blue;}

Upvotes: 1

Related Questions