Beginner CSS and PHP Styling Question

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
chris7519
Forum Newbie
Posts: 1
Joined: Mon Jan 18, 2010 4:42 pm

Beginner CSS and PHP Styling Question

Post by chris7519 »

I am having issues attempting to apply a style to a inline php statement. I am getting the viewer's username and I would like to create a link to their profile when they click on their name. I am using Dreamweaver and can see that the correct style is applied to the Hyperlink Tag itself, but the PHP statement is obtaining the paragraph styling from the "blog_body" DIV. I am new to website development and have obtained a template for this layout, so I have just fiddled around with the style sheet. I'm just confused as to why I can't apply the correct style to a PHP statement. Thank you for any assistance, and I apologize for the low level question!

Code: Select all

 <div class="blog_body">
    <div class="blog_bottom">
    <div class="right">
        <h2>Control Panel</h2>
        <p>Welcome, <a href="custProfile.php" /><?php echo $_SESSION['uname']; ?></a></p>
        <ul>
          <li><a href="#">Philosophy</a></li>
          <li><a href="#">We love what we do</a></li>
          <li><a href="#">Content is King</a></li>
          <li><a href="#">Valid HTML, valid CSS</a></li>
          <li><a href="#">Team</a></li>
          <li><a href="#">Jobs</a></li>
        </ul>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
      </div>
Attachments
style.css.zip
(2.63 KiB) Downloaded 134 times
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Beginner CSS and PHP Styling Question

Post by social_experiment »

There was two slight problems with the html you posted, the code below should fix that, as for the problem with the link not displaying correctly i also found the problem what that, the css code is also below. I almost didn't see the problem because the css file is a total mess, (not due to any fault on your part, it must have been the person who created the template to start with).

You missed a closing div tag and the <a href="#"> doesn't get a closing slash (/), that's what the </a> tag is for. As for the css, the 'color' value was missing the #.

Code: Select all

 <div class="blog_bottom">    <div class="right">        <h2>Control Panel</h2>        <p>Welcome, <a href="custProfile.php" ><?php echo $_SESSION['uname']; ?></a></p>        <ul>          <li><a href="#">Philosophy</a></li>          <li><a href="#">We love what we do</a></li>          <li><a href="#">Content is King</a></li>          <li><a href="#">Valid HTML, valid CSS</a></li>          <li><a href="#">Team</a></li>          <li><a href="#">Jobs</a></li>        </ul>        <p>&nbsp;</p>        <p>&nbsp;</p>      </div>    </div> 
CSS

Code: Select all

 .right p a {    font-family: Arial, Helvetica, sans-serif;    font-size: 11px;    font-style: normal;    color: #2d98c8;    float: none;} 
Attached is an image of what the link looks like with the correct color. Hope this helps.
Attachments
Untitled-3.jpg
Untitled-3.jpg (10.65 KiB) Viewed 784 times
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply