Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 357517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:12:46+00:00 2026-05-12T12:12:46+00:00

I am trying to get better about minimizing any unnecessary markup and using optimal

  • 0

I am trying to get better about minimizing any unnecessary markup and using optimal CSS.

<label id="cart_promocode">Promo-code:
    <span><%= Html.TextBox("PromoCode") %>
       <a href="#" id="lnkApplyCoupon" class="hidden">Apply Coupon</a>
    </span>
</label>

The ‘Apply Coupon’ link should be positioned underneath the textbox.
This is the css I am using. Note that the <A> is displayed as a block so it gets its own line.

#cart_promocode a
{
     display: block;
     margin: 4px 0 0 0;
     font-size: 93%;
     color: Blue;
}

.hidden {
     display: none;
}

I will show and hide it using jQuery with :

 $('#lnkApplyCoupon').show() and hide()

The problem is that I want the item to be initially hidden. The ‘hidden’ class applied initially doesnt work.

The best solution I have come up with is

$(function() {
     $('#lnkApplyCoupon').hide();
});

This will hide the apply coupon link when the page loads, but then if the user doesnt have Javascript enabled it will not initially be hidden – and in fact in that case I dont want it to EVER appear.

What am I missing – either a trick or a different approach to my CSS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:12:47+00:00Added an answer on May 12, 2026 at 12:12 pm

    The ‘hidden’ class applied initially
    doesnt work

    #cart_promocode a { display:block; }
    

    Has a higher specificity ( 101 AFAIK ) than your other rule, specify the ID before the class and you’ll have a higher specificity ( 110 AFAIK ).

    Ids = 100, classes = 10, base selectors = 1.

    #cart_promocode .hidden, .hidden { display:none; }
    

    Two selectors because the second one will do a universal target.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get better at using MVC/MVP style patterns with my WinForm apps
I'm trying to get this piece of code working a little better. I suspect
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm still trying to get a better understanding of Interfaces. I know about what
I'm trying to get a better understanding of what place (if any) Macros have
I'm working through previous years ACM Programming Competition problems trying to get better at
I'm trying to get a better understanding of how Windows, 32-bit, calculates the virtual
Trying to get my css / C# functions to look like this: body {
I'm really trying to get better with this stuff. I'm pretty functional with internationalization
I'm trying to get a better grip on numpy arrays, so I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.