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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:56:01+00:00 2026-05-19T23:56:01+00:00

This site is overriding my CSS with its own and I cannot get around

  • 0

This site is overriding my CSS with its own and I cannot get around it! It has style.css with "text-align: center" in the body.

I have <div id="mydiv"> appended to the body and it’s normally got “text-align: left”. There are <ul>s and <li>s underneath #mydiv and they are inheriting the body’s ‘center’ for some reason. I tried this and it’s still not working.

$('#mydiv').children().css('text-align', 'auto');

How the heck do I reclaim my CSS!?

@Grillz, the HTML looks like this:

<div id="mydiv">
<ul class="container">
    <li rel="folder" class="category"><a href="#">category1</a>
        <ul><li rel="file" class="subcategory"><a href="#">subcategory1</a></li></ul>
        <ul><li rel="file" class="subcategory"><a href="#">subcategory2</a></li></ul>
    </li>
    <li rel="folder" class="category"><a href="#">category2</a>
        <ul><li rel="file" class="subcategory"><a href="#">subcategory3</a></li></ul>
        <ul><li rel="file" class="subcategory"><a href="#">subcategory4</a></li></ul>
    </li>
</ul>

  • 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-19T23:56:02+00:00Added an answer on May 19, 2026 at 11:56 pm

    If you want to do it via jQuery, your .children() is only selecting the <ul>, not the <li>… You need to do something like this:

    $('#mydiv').children().children().each(function() {
        $(this).css('text-align', 'left');
    });
    

    Firstly, its drilling down two levels, down to the <li>. Secondly its using the .each() function to apply the css styling to each child…

    EDIT: after seeing your html above, below is probably more appropriate:

    $('#mydiv').find("li").each(function() {
        $(this).css('text-align', 'left');
    });
    

    This uses the .find() function to find every <li> element inside #myDiv.

    Working jsFiddle (with color instead of text-align) here: http://jsfiddle.net/Damien_at_SF/Vabvu/

    Hope that helps 🙂

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

Sidebar

Related Questions

I am updating an existing ASP .NET site. This site has a custom grid
The css of a major site I am looking at has what appears to
This site is pretty good but I'm wondering what other resources are out there.
I know this site is written using ASP.Net MVC and I do not see
Like many others on this site I am considering a move to ASP.NET MVC
From browsing on this site and elsewhere, I've learned that serving websites as XHTML
I searched all over this site and the web for a good and simple
According to this site I can simply write $user = getlogin(); but the group
I found the ad on this site to Krypton controls ( and here's another
Compared to most people on this site I am admittedly a novice. I wanted

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.