• Resolved papa4174

    (@papa4174)


    I put a css file here:
    /public_html/wp-content/themes/mytheme/test.css

    How can I edit this code to make it point to this external css file?

    Thanks!

    <html xmlns=”https://www.w3.org/1999/xhtml”&gt;
    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <title>Untitled Document</title>
    <link href=”/test.css” rel=”stylesheet” type=”text/css” />
    </head>
    <body>
    <p><span class=”offerlink”>Click Me</span></p>
    </body>
    </html>

Viewing 6 replies - 1 through 6 (of 6 total)
  • <title>Untitled Document</title>
    <link href="<?php bloginfo('template_directory'); ?>/test.css" rel="stylesheet" type="text/css" />
    </head>
    Thread Starter papa4174

    (@papa4174)

    stvwolf mind helping edit this code.

    I put my css file in:
    /public_html/wp-content/themes/mytheme/test.css

    here is the html code I put in a new post:
    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <title>Untitled Document</title>
    <link href=”<?php bloginfo(‘template_directory’); ?>/test.css” rel=”stylesheet” type=”text/css” />
    </link></head>
    <body>
    <p><span class=”cssname”>Click Me</span></p>
    </body>

    Here is the code in my css:
    @charset “utf-8”;
    .cssname {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #FF6699;
    text-decoration: underline;

    Not sure what I’m doing wrong

    You didn’t explain what the problem is.

    For one thing you are missing a closing } on .cssname

    however I don’t know what .cssname relates to or what you are asking for.

    Thread Starter papa4174

    (@papa4174)

    oops I did forget the }

    inside of my external file, .cssname is the style name

    so I want the the text “Click Me” to be styled by the css file.

    but right now my text Click Me in my latest post on my blog is still black. If it were styled by the external css file it should be pink.

    Using <head> tags and such in the post won’t work. That is already called by header.php.

    Simply add the css to the theme main style.css
    Or if it is a one time thing, do <span style="your css here;">

    Is there a specific reason why you need an external test.css? If so, add the call from header.php of your theme.

    Thread Starter papa4174

    (@papa4174)

    thanks buddha! worked like a charm!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to use an external CSS file with my posts’ is closed to new replies.