Author Topic: CSS question  (Read 2828 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
CSS question
« on: June 13, 2012, 06:07:44 pm »
Dumb question I know, but anyway. How do I change the properties for a tag inside a class?

example:

Code: [Select]
<tag class="class">
  <atag></atag>
<tag>

To edit stuff for atag, is it

Code: [Select]
.class atag {
stuff
}

Or is it

Code: [Select]
atag .class {
stuff
}

Thanks
« Last Edit: June 13, 2012, 06:08:18 pm by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: CSS question
« Reply #1 on: June 13, 2012, 07:22:14 pm »
Code: [Select]
atag.class{
  /* stuff */
}
or
Code: [Select]
.class{
   /* stuff */
}
Although this will affect anything with this class. You can also use
Code: [Select]
atag{
   /* stuff */
}
For all references of atag
/e

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: CSS question
« Reply #2 on: June 13, 2012, 07:26:08 pm »
Code: [Select]
atag.class{
  /* stuff */
}
Eeems, he wants to know how to target atag as a descendant of .class, not the element itself.

What you're looking for is
Code: [Select]
.class atag
{
    /* stuff */
}
(your first guess, flyingfisch).
« Last Edit: June 13, 2012, 07:26:45 pm by Deep Thought »




Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: CSS question
« Reply #3 on: June 13, 2012, 07:56:46 pm »
Oh right lol, I just skimmed the question.
Another more specific way to do this would be
Code: [Select]
tag.class atag{
   /* stuff */
}
/e

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CSS question
« Reply #4 on: June 13, 2012, 07:58:43 pm »
Thanks for the replies guys :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: CSS question
« Reply #5 on: June 13, 2012, 08:14:55 pm »
To prevent any confusion, could you explain what is <atag> though? Can one just use any nonexistent tag in his HTML code to assign CSS properties to it?

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: CSS question
« Reply #6 on: June 13, 2012, 10:55:18 pm »
Well, you can actually use nonexistant tags and your browser won't even complain. It won't pass the W3C Validator though. And I never tried it, but I think the CSS parser won't even care if your tag exists or not.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: CSS question
« Reply #7 on: June 14, 2012, 02:40:13 am »
Some might throw warnings. I know I've used non-existent tags before. Not a good idea to do though.
/e

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CSS question
« Reply #8 on: June 14, 2012, 10:07:14 am »
To prevent any confusion, could you explain what is <atag> though? Can one just use any nonexistent tag in his HTML code to assign CSS properties to it?

The reason I used <atag> was just to create some arbitrary code.

It could be any tag like <span>, <div>, etc. ;)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0