• Hi everyone,

    I have what might be a relatively simple question.
    On my main page, https://www.samdiener.com, I want ?php the_content() to generate the content in 9px font. Which it does perfectly.

    However, on subpages, eg. https://www.samdiener.com/2009/08/creative-networking-for-your-job-search-101/ I want the size to be different. However, I am not sure how to render in a different size since the template is calling the_content() to generate content in the same size as the main page.

    The code from my template is

    <div class=”topPost”>
    <h2 class=”topTitle”>“><?php the_title(); ?></h2>
    <p class=”topMeta”>by <?php the_author_posts_link(); ?> on <?php the_time(‘M.d, Y’) ?>, under <?php the_category(‘, ‘); ?></p>
    <div class=”topContent”><?php the_content(‘(continue reading…)’); ?></div>
    <div class=”cleared”></div>
    <span class=”linkpages”><?php wp_link_pages(); ?></span><div class=”cleared”></div>
    <?php if ( function_exists(‘the_tags’) ) : ?><span class=”topTags”><?php the_tags(‘:‘, ‘, ‘, ”); ?></span><?php endif; ?>
    <div class=”cleared”></div>
    </div> <!– Closes topPost –>

    <small><?php edit_post_link(‘Edit this entry?’,”,”); ?></small>

    <div id=”comments”>
    <?php if (function_exists(‘wp_list_comments’)): ?>
    <!– WP 2.7 and above –>

    Thanks guys!

    Sam

Viewing 3 replies - 1 through 3 (of 3 total)
  • In single.php, try changing:

    <div class="topPost">

    to

    <div class="topPost single">

    then you can add:

    `.single p {font-size:npx}

    where n = the size you want to use on single post pages.

    Incidentally, try not to set font sixes oin pts . Pts are best kept for documents that are to be printed. Set font sizes in px, % or em. They all work better on the web.

    Thread Starter samueldiener

    (@samueldiener)

    So in style.css, I add:

    .topPost .single p {font-size:11px}

    If so, this does not work. However, I am pretty sure this is not correct. Also,

    just for my reference, what does the “.” before the single mean vs no “.” vs. # in css

    Thanks!

    Sam

    .topPost .single p {font-size:11px}

    Here you declare .single as a decendent of .topPost, which it is not.

    Just

    .single p {font-size:11px}

    .something declares a class (which is allowed to be more often on a single page) opposed to #something, which is an id. An id can only be once on a single page.

    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CSS help’ is closed to new replies.