2 Replies - 258 Views - Last Post: 01 April 2013 - 10:50 AM Rate Topic: -----

#1 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 39
  • Joined: 22-January 13

Changing Color Of H2 Tag within CSS File**Complicated**

Posted 01 April 2013 - 10:29 AM

So i have a script that will post updates to my webpage. It uses SQL and PHP.

The script itself has an <h2> tag for the headers of the updates.

When i try to edit the H2 Tags within the script, they do not work.
When i use an H2 tag on the main index it works fine.
index File
<div id="content">
              	<img src="images/abovecontent.jpg"/>   
                   <img class="leftcontent" src="images/leftcontent.jpg"/> 
                   <?php include('includes/update.php');?>                                                
                    
                     <div id="pages">
                     <img class="leftcontent" src="images/page1.jpg"/>
                     <img class="leftcontent" src="images/page2.jpg"/>
                     <img class="leftcontent" src="images/page3.jpg"/>
                     </div>  
                   <img src="images/rightcontent.jpg"/>                                             
              </div>
             
            
             <h2>  <?php echo 'how are you'?></h2>
            <div id="footer">
             <img src="images/footer.jpg"/> 
            </div>



update.php file
<div id="update_image">
<img class="leftcontent" src="images/content.jpg"/> 

        <div id="update">
                  <?php
                  while ($row = mysql_fetch_assoc($query)){
                  ?>
                  <h2><a href="index.php?id=<?php echo $row['id']; ?>"> <?php echo $row['title']; ?> </a></h2>
                  <p> <?php echo $row['contents']; ?></p>
                  <?php
                  }
                  ?>
        </div>
</div>



RESULT -As you can see, the H2 Tagged "how are you" Worked fine
Posted Image

Is This A Good Question/Topic? 0
  • +

Replies To: Changing Color Of H2 Tag within CSS File**Complicated**

#2 Shado3225  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 325
  • Joined: 23-February 10

Re: Changing Color Of H2 Tag within CSS File**Complicated**

Posted 01 April 2013 - 10:45 AM

You can hard code the font color:

<h2 style="color:#FF0000;">


or you can target it with a style sheet.

#update h2{color:#FF0000;}

Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3473
  • View blog
  • Posts: 11,792
  • Joined: 12-December 12

Re: Changing Color Of H2 Tag within CSS File**Complicated**

Posted 01 April 2013 - 10:50 AM

You might want to format the a-links within the h2:

h2 a {

}
as well as their :link :visited :hover :active pseudo-selectors.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1