SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Jhorra's Avatar
    Join Date
    Sep 2004
    Location
    Phoenix, Az
    Posts
    551
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible problem with CSS in embedded items

    Basically none of the elements inside the site_content div are being affected be the corresponding CSS

    Here's the CSS
    Code:
    .site_content
    {
    	background-color:#1e1e1e;
    	color:#FFFFFF;
    	margin-bottom:10px;
    	width:100%;
    }
    .site_content a
    {
    	color:#FFFFFF;
    }
    .site_content p
    {
    	margin:5px;
    	padding:0px;
    }
    .site_content p ul
    {
    	padding:0px;
    	margin:0px;
    	list-style:none;
    }
    .site_content p ul li
    {
    	padding:0px;
    	margin:0px;
    	list-style:none;
    }
    And here's the code on the page
    Code:
    <div class="site_content">
    	<p>Profile image</p>
    	<p>
    		<ul>
    			<li><?php echo stripslashes($this->user->username); ?></li>
    			<li><?php echo $this->profile->views; ?> Profile Views</li>
    		</ul>
    	</p>
    	<p></p>
    </div>

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,484
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    HI,

    When something doesn't work the way you think it should your first check should be a trip to the validator to check your css and html to make sure what you are saying is valid.

    The UL cannot be inside a p element because p elements can only contain inline elements. Remove the p tags from around the UL and change your css to reflect this and it should work.

  3. #3
    SitePoint Evangelist Jhorra's Avatar
    Join Date
    Sep 2004
    Location
    Phoenix, Az
    Posts
    551
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I didn't realize that about p elements. I'll change them to divs.

    Thanks

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,484
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    The ul doesn't need to be wrapped in anything so don't add divs unless you really need to. Use semantic html and you won't go far wrong


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •