CSS doesn't work on Localhost

Community Forums Forums General Discussion CSS doesn't work on Localhost

This topic is: resolved

This topic contains 18 replies, has 3 voices, and was last updated by  cdils 10 months ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #47674

    MM
    Participant
    Post count: 126

    Hi,

    Have cloned and setup my site on a localhost (on mac / mamp). However site only displays the html. The theme and CSS doesn’t work. I’ve tried clearing caches, but nothing changed. Has anyone experienced this or able to suggest an answer here?

    Thks.

    #47760

    cdils
    Participant
    Post count: 415

    Hi,

    What child theme are you using? Unless you’ve modified the default method for calling in the style sheet, there’s no reason it shouldn’t work in local environment.

    Make sure there’s a style.css file in your theme’s root directory, otherwise your theme will not work.

    Carrie


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I tweet @cdils.

    #47762

    MM
    Participant
    Post count: 126

    Thks Carrie. Using Epik theme and yes, style.css is definitely there – so unsure why it doesn’t work.

    #47764

    cdils
    Participant
    Post count: 415

    When you say the theme doesn’t work… Are you able to successfully activate Epik or does that cause the site to break?

    Can you activate one of the default themes (Twenty Eleven / Twenty Twelve, etc.) with any success?


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I tweet @cdils.

    #47767

    MM
    Participant
    Post count: 126

    Good tip. Just tested and no, 2012 theme isn’t successfully activating the CSS.

    I had previously tested both Epik and 2012 on a live site and they worked fine.

    ?

    #47774

    Trisha
    Participant
    Post count: 19

    So to be clear your html generated by WordPress is working it is only the CSS that is not working?

    When you view the source for your page does it display a link to the CSS at all?


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    #47777

    MM
    Participant
    Post count: 126

    Thks Trisha.

    Yes, html elements showing (i.e. blue links, images, menu & footer words) but zero styling.

    I look at the page source and found no link to style.css

    #47783

    cdils
    Participant
    Post count: 415

    Sounds like there’s something funky with the WordPress install. I’d try downloading a fresh copy of WordPress, just in case. You don’t have to go through the installation process again – just replace the wp-admin and the wp-install folders and files (don’t replace wp-content) with your fresh ones and see if that works.

    p.s. You can replace the root files too except for wp-config.php. :)


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I tweet @cdils.

    • This reply was modified 10 months ago by  cdils. Reason: p.s
    • This reply was modified 10 months ago by  cdils. Reason: p.s
    #47800

    MM
    Participant
    Post count: 126

    Thanks Carrie but that didn’t work either. I tried replacing as suggested, and also even ran Duplicator again.

    Still no CSS. I’m confused as to why theme CSS works fine on my live site but no themes work on my localhost.

    #47810

    Trisha
    Participant
    Post count: 19

    This is a very strange thing.

    If you create a completely fresh WordPress site on your localhost does that CSS work? (Unfortunately I am trying to help you from XAMP – the Windows version of MAMP).

    Have you modified anything in the header.php of the theme?


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    #47830

    MM
    Participant
    Post count: 126

    Thks Trisha. I just installed a basic site with 2012 theme – and the CSS / layout looks fine.

    I then loaded Genesis parent and Epik child theme into the new Localhost – CSS appeared on the ‘hello world’ post.

    Strange? It just doesn’t seem to work when connecting my actual database with lots of existing posts / pages.

    #47834

    cdils
    Participant
    Post count: 415

    Oh, that’s interesting to note that it works with sample database, but not your imported data.

    What if you exported your database using the native WordPress export and then brought it in to your new installation. (Assuming that was not your clone method originally?).

    Isn’t troubleshooting fun? :)


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I tweet @cdils.

    #47856

    MM
    Participant
    Post count: 126

    Thks Carrie – yes it’s weird (and sorta fun!). Will try export / imports and seeing if I can get CSS working with old database content… stay tuned ;)

    #47987

    Trisha
    Participant
    Post count: 19

    Hi MM,

    In your debugging mission I would consider opening the source of the two installs side by side and comparing the head section of the source. I am very surprised that it is with the database that is de-activating your CSS since that should generally be a feature of the functions (php) and not the database (mySQL).

    As Carrie says the wild adventurous world of troubleshooting.


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    #47989

    MM
    Participant
    Post count: 126

    Hi Carrie,Trisha,Others

    Here’s the results… I was able to connect the existing database onto the new WP installation’s site folder, on Localhost.

    BUT… again there’s no CSS working on the login screen or the front end. No idea – this could make changes quite tough.

Viewing 15 posts - 1 through 15 (of 19 total)

The topic ‘CSS doesn't work on Localhost’ is closed to new replies.