Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post CSS properties for *only* a specific appearance of a tag.

    Hi,

    I've seen things like this in CSS elsewhere:

    Code:
    <style type="text/css"><!--
    td[width="350"] {
        background-color: #FFFFFF;
    }
    --></style>
    The above is just an example, and it might not even be what I'm looking for. But it appears that the above would only change the background color of a table cell that is 350 pixels wide (no other table cells will be changed)?

    Is this how this is done? And if not, I'm trying to do something along that concept, somewhat like this:

    Code:
    <style type="text/css"><!--
    table[border="2"] td .classname {
        color: #FFFFFF;
        font-family: verdana;
    }
    --></style>
    If this doesn't make sense, I'll try to reexplain.

    But if this can be done I'd be ever so grateful.

    Thanks!
    ~Kevin

  • #2
    Regular Coder
    Join Date
    Jul 2004
    Location
    mile high city
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This page has a great explanation of CSS selectors, the type you're describing are called attribute selectors. You'll find a link for these about halfway down the page.

    http://css.maxdesign.com.au/selectutorial/
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a million for the link!

    I have discovered another problem, however. That page says that Internet Explorer does not support attribute selectors. I looked at the other selectors and none of the ones I could possibly use are supported, either.

    Is there another way to go about what I am trying to do?

    Thanks!
    ~Kevin

  • #4
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    IE doesn't like them yet so could you just do something like (?) :

    Code:
    <style type="text/css">
    .table1 {
    border: 2px solid #000;
    }
    .table1 td {
    color: #fff;
    font-family: verdana;
    }
    </style>
    Code:
    <table class="table1"><tr><td></td></tr></table>
    that should work as intended. Any table that you give the class="table1" to should have black borders and all the td's in the table have white verdana text.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by harbingerOTV
    IE doesn't like them
    That is well known. That is why they are used to hide some styling from IE.

  • #6
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Quote Originally Posted by Kurashu
    That is well known. That is why they are used to hide some styling from IE.
    true that. By the sounds of it though Kevin doesn't want to hide his styling from IE though.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • #7
    New Coder
    Join Date
    Apr 2005
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh, well, it's not that I don't want to do that, it's that I can't.

    I'm trying to do it on a MySpace profile that really limits what you can do. For instance, it doesn't let you use the pound symbol (#) anywhere, so I can't do anything with ID's. And of course I can't change the HTML that is auto-generated. :/

    So, this is why I was wondering if there was a way. Heh. Because the auto-generated HTML lacks a class definition (like I said, I can't use an ID definition).

    Thanks anyway. (:

  • #8
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you really really want css 2 selectors, give IE7 a go.

    http://dean.edwards.name/IE7/
    CATdude about IE6: "All your box-model are belong to us"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •