• i am developing a template and i am having some problems i am a newbie when comes to coding here is what is going on:

    i have created a css files called style.css and added the following:
    what i want to do is a css to control every post in my page and assign different colors to each divs but the color divs are not showing up.

    The CSS code:

    .PostBackground1 {
    	 background-color: #FF8000;
    }
    .PostBackground2 {
    	 background-color: #F9DBFB;
    }

    the index.php code:

    and then in my code i add all this to show the post in a loop:

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
    <?php if ($count == 1) : ?>
    
     <!-- the problem below is that i use the div class and it did not change the post background -->
    
    <div class="PostBackground1">
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    </div>
    
    <!-- end of first post loop going to second loop -->
    
    <?php elseif ($count == 2) : ?>     
    
    <div class="PostBackground2">
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    </div>

    any advices? im having a headacke =)

Viewing 1 replies (of 1 total)
  • Thread Starter demmios

    (@demmios)

    and if i code inside the div the post shows correctly with the colors.

    like this:

    <div class=”Conteudo” style=”background-color:#FF0080″>

Viewing 1 replies (of 1 total)
  • The topic ‘Css on posts not working’ is closed to new replies.