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

  • Home
  • SEARCH
  • 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 399907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:53:32+00:00 2026-05-12T16:53:32+00:00

Is there a way to point to the default CSS class of an object?

  • 0

Is there a way to point to the default CSS class of an object?

For example, depending if a user is logged in I want to specify a different CSS class to control the style of a header.

$css_class = "";
if($logged_in)
    $css_class = "success"

echo "[h1 class=".$css_class."] My Title [/h1]"

If the user is logged in, the css class is set to “success”” otherwise, it’s set to “”.

I know it’s improper w3c to have a blank class, but is there a way that I can just point to the default H1 property instead of creating a separate “not logged in” css class?

  • 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-12T16:53:32+00:00Added an answer on May 12, 2026 at 4:53 pm
    $css = $logged_in ? 'success' : 'dummy-undefined-css-value';
    echo "<h1 class=\"$css\">My Title</h1>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to get the local end point of a connected Silverlight
Is there a way to return a point for a string within a text
Is there a way to make a LinkedList in C# point to multiple children,
Is there a way for me to have eclipse start and point to a
Is there any way to rotate a disclosure button? I'd like it to point
Is there a standard/common way to give compiler-style error messages that point to a
Is there a way to print all methods of an object in JavaScript?
Is there an easy way in WPF to specify the orientation of an icon
Is there a way to have a default parameter passed to a action in
Is there any way to print an OOXML document (.docx file) without having MS

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.