SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Thread: Setting back to default behavior.

  1. #1
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Setting back to default behavior.

    Let say I set some rules for an anchor tag at the top of my css sheet like the following:

    HTML Code:
    a{
    
    	text-decoration: none;
    	color: #000;
    
    }
    Then I needed some part to have the default anchor tag rules like the underline and the blue color. I know I can re-declare the colors, but is there a syntax to do this fast?

  2. #2
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,927
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    You can just use the same syntax as above. However, if you want to target just a particular <a>, then you'd need something more specific. E.g.

    Code:
    <div class="header">
      <p>This is <a href="">a link</a> in a paragraph.</p>
    </div>
    you can style this like so:

    Code:
    .header a {
      color: green;
      text-decoration: underline;
    }
    There are lots of other info, though, depending on your HTML, so we'd need to see a specific example to give better advice.

  3. #3
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry if I have not been clear enough. I'm okay with targeting and yes as you just had to re-declare values of those particular properties. Is there a short cut to get the default behavior?

    HTML Code:
    .header a {
      reset:resetall; /*I'm making these up*/
    }
    Quote Originally Posted by ralph.m View Post
    You can just use the same syntax as above. However, if you want to target just a particular <a>, then you'd need something more specific. E.g.

    Code:
    <div class="header">
      <p>This is <a href="">a link</a> in a paragraph.</p>
    </div>
    you can style this like so:

    Code:
    .header a {
      color: green;
      text-decoration: underline;
    }
    There are lots of other info, though, depending on your HTML, so we'd need to see a specific example to give better advice.

  4. #4
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,927
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by ameerulislam View Post
    Is there a short cut to get the default behavior?
    Yes, the shortcut is not to remove it in the first place.

  5. #5
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Yes, the shortcut is not to remove it in the first place.
    yeah right lol.

  6. #6
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,927
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    The ideal is not to add/remove any styling that you then have to undo later on. So it sounds like a better idea for you to target the links for which you want the underline removed, and leave the rest alone.

  7. #7
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    The ideal is not to add/remove any styling that you then have to undo later on. So it sounds like a better idea for you to target the links for which you want the underline removed, and leave the rest alone.
    In my case I'm removing underline from all except few specific places.

  8. #8
    Mouse catcher silver trophy
    SitePoint Award Recipient Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,096
    Mentioned
    66 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ameerulislam View Post
    In my case I'm removing underline from all except few specific places.
    If you don't mind it not working in IE<8, you can use :not(), which allows you to specify styling for, eg, all <a> elements except those that you give a particular class to. As you would expect, this has worked in Opera, Firefox, Chrome and Safari since fairly shortly after the dawn of time, but IE has only got round to implementing it in v9.
    Any posts I write in Arial are on my mobile phone, so please excuse typos etc.
    Any posts I write in Verdana are on a PC, so feel free to berate me mercilessly for any mistakes


  9. #9
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    If you don't mind it not working in IE<8, you can use :not(), which allows you to specify styling for, eg, all <a> elements except those that you give a particular class to. As you would expect, this has worked in Opera, Firefox, Chrome and Safari since fairly shortly after the dawn of time, but IE has only got round to implementing it in v9.

    Sounds great. I'll try it out.. I should care less about IE<8.

  10. #10
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,743
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by ameerulislam View Post
    I'm sorry if I have not been clear enough. I'm okay with targeting and yes as you just had to re-declare values of those particular properties. Is there a short cut to get the default behavior?
    There will be when its supported as the "all" property will do this:

    You will just have to wait a little while for browsers to implement it assuming it gets past the working draft.

  11. #11
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    There will be when its supported as the "all" property will do this:

    You will just have to wait a little while for browsers to implement it assuming it gets past the working draft.
    This sounds even better.

  12. #12
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    Auckland, New Zealand
    Posts
    11,049
    Mentioned
    452 Post(s)
    Tagged
    7 Thread(s)
    Hi @ameerulislam ;
    If you haven't solved the problem yet and you're keen to get it done on-the-spot, you could try out a new product that we've built at SitePoint called Codefix.
    Our CSS experts work through your problem with you live until you have a fix.

    Head on over to codefix.sitepoint.com if you're interested.

  13. #13
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by HAWK View Post
    Hi @ameerulislam ;
    If you haven't solved the problem yet and you're keen to get it done on-the-spot, you could try out a new product that we've built at SitePoint called Codefix.
    Our CSS experts work through your problem with you live until you have a fix.

    Head on over to codefix.sitepoint.com if you're interested.
    Nice product, I can't find the fee's structure.

  14. #14
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,927
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by ameerulislam View Post
    Nice product, I can't find the fee's structure.
    At the moment it's being tested and looking for candidates to test it on, so HAWK is offering it to you as a free process.

  15. #15
    SitePoint Enthusiast ameerulislam's Avatar
    Join Date
    Jul 2011
    Posts
    68
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    At the moment it's being tested and looking for candidates to test it on, so HAWK is offering it to you as a free process.
    That's a great opportunity.

Bookmarks

Posting Permissions

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