Jump to content


Photo

CSS rule to only apply on a certain HTML tag!


  • Please log in to reply
8 replies to this topic

#1 Tombayo

Tombayo
  • Members
  • 8 posts
  • Division:Revora
  • Job:Freelancer

Posted 24 February 2008 - 06:05 PM

Deleted


Edited by Tombayo, 18 July 2013 - 02:07 PM.


#2 Clement

Clement

    title available

  • Network Staff
  • 1,442 posts
  • Location:France
  • Projects:Various
  •  T3A Team Chamber Member
  • Division:Revora
  • Job:Developer

Posted 24 February 2008 - 06:26 PM

Well you have made a class in the p tag, so you can use:

.test a {
/* css */
}
Posted Image

#3 Duke

Duke

    Doctor Doctor!

  • Members
  • 420 posts
  • Location:New Zealand

Posted 25 February 2008 - 04:22 AM

Could you not also just:

<a href="asd.com" class="test">asd</a>?

#4 Mastermind

Mastermind

    Server Technician

  • Undead
  • 7,014 posts
  • Location:Cambridge, MA
  • Projects:MasterNews 3
  •  The Man Behind the Curtain

Posted 25 February 2008 - 06:41 AM

Yes, but if you want to apply a certain style to all of the links in a certain section, this way is better.
Posted Image

Well, when it comes to writing an expository essay about counter-insurgent tactics, I'm of the old school. First you tell them how you're going to kill them. Then you kill them. Then you tell them how you just killed them.

Too cute! | Server Status: If you can read this, it's up |

#5 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  •  Friendly neighborhood standards Nazi

Posted 25 February 2008 - 12:32 PM

Or if you want specifically the first link in that class:
.test > a:first-child {}

Or specifically that url:
a[href="asd.com"] {}

Or CSS3 *head explodes from possibility overload*

You may also wanna add http://'s, unless you're linking to relative files with .com file extensions :ohmy:

World Domination Status: 2.7%


#6 Bart

Bart

  • Network Admins
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 25 February 2008 - 12:48 PM

ok weird, yesterday i replied that it's better to use ID's for single style changes, but my post is gone...
i can remember the forum being unreachable though, probably after i clicked the submit button :-/
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."

#7 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  •  Friendly neighborhood standards Nazi

Posted 26 February 2008 - 08:19 AM

It does that sometimes...
And good point

World Domination Status: 2.7%


#8 Kravvitz

Kravvitz

    [X]HTML, CSS, & JS/DOM Adept

  • Members
  • 443 posts
  • Location:USA

Posted 29 February 2008 - 02:06 PM

it's better to use ID's for single style changes

Why? I'd argue that IDs should be used for unique things, which is not necessarily the same as a single thing. You might just want to apply a style to one element bu apply it to multiple elements later.

#9 Bart

Bart

  • Network Admins
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 29 February 2008 - 08:14 PM

Why? I'd argue that IDs should be used for unique things, which is not necessarily the same as a single thing. You might just want to apply a style to one element bu apply it to multiple elements later.

depends on the definition of single. in this case, i meant single = unique, about which you're of course right ;)
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users