Jump to content

First child not working

stefanmz
Go to solution Solved by DPS100,
1 minute ago, stefanmz said:

Oh yeah sorry I forgot CSS but I actually solved it by just using the element in element structure like element element{code} you know 

I don't know CSS, but I'm glad to hear you figured it out! Sometimes just asking a question gets you in the mindset to solve it.

So I have this code and all the headers are with gradient even though I specified only first child. The others should be green. When I try with another code it works,why doesn't with mine?

*{
	margin: 0px;
	padding: 0px;
}
header:first-child {
	background: rgb(255,0,0);
    background: linear-gradient(90deg, rgba(255,0,0,1) 0%,rgba(255,0,0,1) 33%, rgba(0,128,0,1) 33%,rgba(0,128,0,1) 66%, rgba(0,0,255,1) 		   66%,rgba(0,0,255,1) 99%);
    color: #ffff00;
    text-align: center;
    font-family: Arial;
    font-size: 35px;
    font-weight: bold;
    padding-bottom:15px;
    padding-top:1px;
}
header{
	background:green;
}

UPDATE:same with first-of-type

Edited by stefanmz
Update
Link to comment
Share on other sites

Link to post
Share on other sites

You might want to be more specific with your question and change your title to describe your problem a bit more, or add tags to get people who can help you interested (ex. I'm not sure what language this is written in).

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, DPS100 said:

You might want to be more specific with your question and change your title to describe your problem a bit more, or add tags to get people who can help you interested (ex. I'm not sure what language this is written in).

Oh yeah sorry I forgot CSS but I actually solved it by just using the element in element structure like element element{code} you know 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, stefanmz said:

Oh yeah sorry I forgot CSS but I actually solved it by just using the element in element structure like element element{code} you know 

I don't know CSS, but I'm glad to hear you figured it out! Sometimes just asking a question gets you in the mindset to solve it.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×