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 7616633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:56:12+00:00 2026-05-31T02:56:12+00:00

I am trying to change the CSS styles in the header, but I cannot

  • 0

I am trying to change the CSS styles in the header, but I cannot figure it out. I have scoured the internet for relevant things, & found these to be the closest: .css(), .addClass()

I generated an image using canvas, then converted it into base64 text. Now I need to stick it into the main CSS to get something like this:

<head><style>
    .icoDL{width:20px; height:20px; background-image: url("data:image/png;base64,abcdabcdabcd");}
</style></head><body>
    <div class="icoDL"></div> Link 1
    <div class="icoDL"></div> Link 2
    <div class="icoDL"></div> Link 3
</body>

However, what I am finding results in something like this:

<div class="icoDL" style="background-image: url('data:image/png;base64,abcdabcdabcd . . .
    Some link
<div class="icoDL" style="background-image: url('data:image/png;base64,abcdabcdabcd . . .
    Another link

I want it to be in the head so it does not destroy the computer’s performance.

Other people have asked the same or similar questions, & I see in all of them, .css(), & .addClass().
That does not work for me though.

.CSS() just adds the style to the element like so:

From:

<!DOCTYPE html><html><head>
  <style>
  p { color:blue; width:200px; font-size:14px; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

  <p>Just roll the mouse over me.</p>

  <p>Or me to see a color change.</p>


<script>
  $("p").mouseover(function () {
    $(this).css("color","red");
  });
</script></body></html>

To:

<!DOCTYPE html><html><head>
  <style>
  p { color:blue; width:200px; font-size:14px; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"/>
</head>
<body>

  <p style="color: red;">Just roll the mouse over me.</p>

  <p style="color: red;">Or me to see a color change.</p>

<script>
  $("p").mouseover(function () {
    $(this).css("color","red");
  });
</script></body></html>

.addClass() does the same thing, as far as I can tell:

From:

<!DOCTYPE html><html><head>
  <style>
  div { background: white; }
  .red { background: red; }
  .red.green { background: green; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

 <div>This div should be white</div>
 <div class="red">This div will be green because it now has the "green" and "red" classes.
   It would be red if the addClass function failed.</div>
 <div>This div should be white</div>
 <p>There are zero green divs</p>

<script>
  $("div").addClass(function(index, currentClass) {
    var addedClass;

    if ( currentClass === "red" ) {
      addedClass = "green";
      $("p").text("There is one green div");
    }

    return addedClass;
  });
</script></body></html>

To:

<!DOCTYPE html><html><head>
  <style>
  div { background: white; }
  .red { background: red; }
  .red.green { background: green; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"/>
</head>
<body>

 <div>This div should be white</div>
 <div class="red green">This div will be green because it now has the "green" and "red" classes.
   It would be red if the addClass function failed.</div>
 <div>This div should be white</div>
 <p>There is one green div</p>

<script>
  $("div").addClass(function(index, currentClass) {
    var addedClass;

    if ( currentClass === "red" ) {
      addedClass = "green";
      $("p").text("There is one green div");
    }

    return addedClass;
  });
</script></body></html>

As far as I can tell, these functions are not what I am looking for. I feel like I am reading it wrong though.

Anyone have any suggestions?

Thanks for reading.

  • 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-31T02:56:13+00:00Added an answer on May 31, 2026 at 2:56 am

    Try this:

    (doesn’t even use jQuery, it’s straight javascript)

    var css = document.createElement("style");
    css.type = "text/css";
    css.innerHTML = "div { background: white; } p { color:blue; width:200px; font-size:14px; } ";
    document.body.appendChild(css);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird background I am trying to figure out the best way
Ok, am trying to figure out the best way to do this. I have
I'd like to be able to change some of the default CSS styles for,
I'm trying to decide the best approach to implementing the majority of CSS styles
Good day, I've got a simple CSS question. I'm trying to change a table
I have a feeling that this probably is not possible using strictly CSS, but,
I have a jQuery UI Button that I am trying to style using CSS.
I'm trying to install a jquery plugin but i cannot make it work. This
I'm trying to change the styles of the price on the different pages. In
Hi im trying to set the css style for this but I dont know

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.