Forum Moderators: not2easy
<!-- begin sidebar -->
<div id='menu-left'>
<?php if ( !function_exists('dynamic_sidebar')
¦¦ !dynamic_sidebar() ) : ?>
<ul>
<?php wp_list_pages('title_li=<h2>Main Menu</h2>'); ?>
</ul>
<h2><?php _e('Categories'); ?></h2>
<ul>
<li id="categories">
<ul>
<?php wp_list_cats(); ?>
</ul>
</li>
<li id="archives"><h2><?php _e('Archives'); ?></h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
</li>
<?php get_links_list(); ?>
</ul>
<ul>
<li id="meta"><h2><?php _e('Meta'); ?></h2>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
<li><a href="" title="Valid CSS">Valid CSS</a></li>
<li><a href=""><abbr title="XHTML Friends Network">XFN</abbr></a></li>
<li><a href="" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>"><abbr title="WordPress">wordpress</abbr></a></li>
<?php wp_meta(); ?>
</ul>
</li>
<li>
<div class="ad200">
</div></li>
</ul><?php endif; ?>
</div>
<!-- end sidebar -->
---------------------------------------------------
/*
* Left sidebar
*/
#menu-left {
float: left;
padding: 70px 12px 20px 12px;
width: 247px;
font-size: 11px;
overflow:hidden;
margin-top: -70px;
}
#menu-left h2 {
font-size: 12px;
margin: 0px 0 0px 0px;
padding: 0px 0 0px 0px;
font-weight: bold;
color: #feba47;
background: url("images/menu-left-title-background.jpg");
border-top: 1px solid #2e1901;
border-bottom: 1px solid #2e1901;
}
#menu-left a,
#menu-left a:visited {
text-decoration: none;
font-weight: bold;
color: #2e1901;
line-height: 15px;
}
#menu-left a:hover,
#menu-left a:visited:hover {
color: #2e1901;
text-decoration: underline;
}
#menu-left ul ul { padding-bottom: 0px;
margin-left: 15px;
}
#menu-left ul ul li {
list-style-type: circle;
color: #2e1901;
}
Just in case someone drops by and wants to see. Here is the whole css file, not just the sidebar.
/*
* Default HTML tags
*/
a {
color: #fe9a00;
}
a:visited {
color: #fe9a00;
text-decoration: underline;
}
a:hover {
color: #fe9a00;
}
acronym, abbr {
cursor: help;
}
blockquote {
margin-left: 15px;
padding-left: 10px;
}
body {
background: url("images/background.jpg");
color: #9c6830;
font-size: 62.5%;
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
margin: 0 auto;
padding: 0;
text-align: center;
}
cite {
font-size: 90%;
font-style: normal;
}
h2 {
font-size: 13px;
margin: 0px 0 0px 0px;
padding: 0px 0 0px 0px;
font-weight: bold;
color: #f8e7bc;
background: #603200;
}
h2 a,
h2 a:visited,
h2 a:hover,
h2 a:visited:hover {
text-decoration: none;
color: #f8e7bc;
}
h3 {
font-size: 120%;
margin-top: 0;
}
img {
padding: 3px;
border: none;
}
img.alignleft {
float: left;
margin: 3px 3px 1px 0;
}
img.alignright {
float: right;
margin: 0 3px 1px 3px;
}
.post img {
padding: 3px;
border: 1px solid #603200;
background: #603200;
}
li {
margin: 0;
padding: 0;
list-style-type: none;
}
ol#comments li p {
font-size: 100%;
}
ul {
margin: 0;
padding: 0;
}
/*
* Classes
*/
/* The credits at the bottom of the site */
#credit {
color: #b88248;
font-size: 11px;
width: 900px;
text-align: center;
margin: 0 auto;
padding: 0px;
clear: both;
height: 0px;
}
#credit a,
#credit a:hover,
#credit a:visited,
#credit a:visited:hover {
color: #b88248;
}
/* Link to the comments */
.feedback {
color: #fe9a00;
text-align: right;
padding-bottom: 15px;
clear: both;
text-transform: lowercase;
}
.feedback a,
.feedback a:visited {
text-decoration: none;
color: #fe9a00;
}
.feedback a:hover,
.feedback a:visited:hover {
text-decoration: underline;
color: #fe9a00;
}
/* The post informations */
.meta li,
ul.post-meta li {
display: inline;
}
.meta ul {
display: inline;
list-style: none;
margin: 0;
padding: 0;
}
.meta a {
color: #fe9a00;
text-transform: lowercase;
text-decoration: underline;
}
.meta {
color: #9c6830;
font-size: 0.9em;
font-weight: normal;
letter-spacing: 0;
}
.storycontent {
font-size: 115%;
}
/* Comment form design */
#commentform #author,
#commentform #email,
#commentform #url,
#commentform textarea {
background: #faf3eb;
border: 1px solid #603200;
color: #2e1901;
}
#commentform textarea {
width: 95%;
}
#commentlist li ul {
font-size: 110%;
}
ol#commentlist li {
list-style: decimal;
}
#content {
float: left;
width: 580px;
background: #2e1901;
margin: 30px 8px 0px 8px;
text-align: left;
padding: 10px;
border: 1px solid #603200;
line-height: 14px;
}
#content ol li {
list-style: decimal;
}
#content ul {
margin-top: 10px;
margin-left: 35px;
}
#content ul li {
list-style-image: none;
}
#content-big {
float: left;
width: 580px;
background: #2e1901;
margin: 0px 8px 0px 8px;
text-align: left;
padding: 10px;
border: 1px solid #603200;
line-height: 14px;
}
#header {
font-size: 26px;
font-weight: bold;
text-decoration:none;
font-family: Verdana;
margin: 0 auto;
height: 288px;
width: 900px;
padding: 0;
background: url("images/wordpressheader.jpg");
}
.header-title {
font-family: Tahoma, Verdana, Arial;
color:#f8e7bc;
font-size:28px;
font-weight:bold;
padding:30px 0 0 448px;
text-align:left;
}
.header-title a{
color:#f8e7bc;
text-decoration:none;
border-bottom:none;
}
.header-title a:hover{
color:#f8e7bc;
text-decoration:none;
border-bottom:none;
}
.header-description {
font-family:Tahoma, Arial, Helvetica, sans-serif;
color:#fe9a00;
font-size:11px;
padding:0px 0 0 449px;
text-align:left;
font-weight:normal;
}
.rss {
float: left;
width: 243px;
height: 96px;
margin: 98px 0 0 10px;
}
#footer {
width: 900px;
height: 38px;
margin: 0 auto;
color: #b88248;
}
#footer p {
text-align: left;
padding-left: 285px;
color: #b88248;
}
#footer a {
color: #b88248;
text-decoration: none;
}
#footer a:hover {
color: #b88248;
text-decoration: none;
}
#footer a:visited {
color: #b88248;
text-decoration: none;
}
#footer a:visited:hover {
color: #b88248;
text-decoration: none;
}
/*
* Left sidebar
*/
#menu-left {
float: left;
padding: 70px 12px 20px 12px;
width: 247px;
font-size: 12px;
overflow:hidden;
margin-top: -70px;
}
#menu-left h2 {
font-size: 15px;
margin: 0px 0 0px 0px;
padding: 0px 0 0px 0px;
font-weight: bold;
color: #feba47;
background: url("images/menu-left-title-background.jpg");
border-top: 1px solid #2e1901;
border-bottom: 1px solid #2e1901;
}
#menu-left a,
#menu-left a:visited {
text-decoration: none;
font-weight: bold;
color: #2e1901;
line-height: 5px;
}
#menu-left a:hover,
#menu-left a:visited:hover {
color: #2e1901;
text-decoration: underline;
}
#menu-left ul ul { padding-bottom: 0px;
margin-left: 15px;
}
#menu-left ul ul li {
list-style-type: circle;
color: #2e1901;
}
.ad200 {
text-align: center;
margin-bottom: 0px;
}
/* End of left sidebar */
input#s {
width: 158px;
border: 1px solid #c2f49d;
color: #444;
}
#rap {
width: 900px;
margin: 0 auto;
background: url("images/rap-background.jpg") repeat-y;
text-align: left;
}
#searchbutton {
margin-top: 2px;
}
#menu-left h2 {
font-size: 15px;
margin: 0px 0 0px 0px;
padding: 0px 0 0px 0px;
font-weight: bold;
color: #feba47;
background: url("images/menu-left-title-background.jpg");
border-top: 1px solid #2e1901;
border-bottom: 1px solid #2e1901;
}
But this h2 within the function
<ul>
<?php wp_list_pages('title_li=<h2>Main Menu</h2>'); ?>
</ul>
Would
#menu-left h2
be the same as
#menu-left ul h2 or
#menu-left li h2 ?
view the generated HTML source of the page.. don't give us the WP/PHP code it's not helpful we don't know what your particular template produces - CSS only styles HTML and if we can't see the full structure it's all guess work ;)
copy the HTML code for the whole left column (from the view source option) into a separate page text/wysiwyg editor copy all that CSS you just posted into the same page then remove the css rules that don't apply (keep checking your page if you can't sight read it) then post us a sample of the code showing the gap (both HTML and CSS)
@marcia
Isn't that particular <h2> a list item - <li> - inside a <ul>, according to that?
it wouldn't matter, it's that specificity thing again and the little touted fact that the actual element selector, in this case the H2 also overrules a more specific selector that doesn't include the target element
e.g.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Page Title </title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css" media="screen">#menu-left h2 {color: #f00;}
body #menu-left ul li {color: #00f;}#menu-left h2, #menu-left ul {margin: 0;}
</style>
</head>
<body>
<div id="menu-left">
<ul>
<li><h2>the h2 title</h2>
<ul>
<li>list item 1</li>
<li>list item 2</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
the above h2 is told to be red.. using the
#menu-left h2 selector; the second selector *is* more specific to the actual list item according to the specificity calculation [webmasterworld.com] method - but it fails to actually explicitly target the h2 so the first rule still wins in this case.. this specificity stuff is fun isn't it @preeminent, I also put which margins need to zero in that code sample.. and because I can apply your CSS to my sample and get no gap too.. there must be something else in your HTML
<h3>Pages</h3>
<ul>
<li class="page_item"><a href="">Home</a></li>
<li class="page_item page-item-2"><a href="" title="About P-Squared">About P-Squared</a></li>
</ul>
<h3>Hankerin'</h3>
<ul class='xoxo blogroll'>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<h3>Recent Posts</h3><ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<h3>Archives</h3><ul>
<li></li>
</ul>
<h3>Search Posts</h3>
<ul>
<li>
<form id="searchform" method="get" action="">
<input type="text" name="s" size="18" /><br>
<input type="submit" id="submit" name="Submit" value="Search" />
</form>
</li>
</ul>
<h3>Meta</h3><ul>
<li><a href"">Log in</a></li>
<li><a href="" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>
<li><a href="" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>
<li><a href="" title="Powered by , state-of-the-art semantic personal publishing platform."></a></li>
</ul>
</div>
<!-- end sidebar -->
Here's a test -- cut and paste the following at the very end of styles.css
/* START: test if the word "pages" is red in left menu */
#menu-left h3 {
color: red;
}
/* END: test */
The PITA thing with WP is when you use widgets, the code comes from them -- (your side bar appears to be "widgetized", so you get the dynamic_sidebar code which you can't see in the theme editor.
A few helpful WP CSS tips:
1. Always do a view source on the HTML rendered in a browser, (don't count on what you typed into the Visual Editor,the HTML editor or the Theme Editor), WP's engine rewrites stuff on the way out.
2. Always clear the cache to make sure your seeing the latest CSS file(s).
3. If possible, test CSS by changing the element with something obvious, (like coloring text red that is usually black), this is much easier to spot than margins, padding, etc.. which can be more browser dependent. Once you know you've nailed the selector, you can tweak the CSS properties.
4. Wear a tinfoil hat that is duct-taped to your head, (the only reason for this tip, is it will be harder to resist the urge to rip your hair out since it's all covered in tinfoil).
NOTE: in the case of the word "Pages"... are you sure it isn't the <UL> below it causing the space -- and maybe its not coming from the bottom of the <H3> at all?
Nah, you're not an idiot.. you are not the only one that posts the WP code thinking the rest of us are WP geniuses ;) - though I'm sorry if I was bit short with you, at the minute this CSS forum is reading a bit like a WP help forum ;) though I'm sure that's because some are coming to CSS from that particular angle
nice tips there from lexipixel :)
in the code they have all this H2 stuff with the sidebar and really they are H3s.
all you need to do for an initial tweak is change or add
#menu-left h2, [b]#menu-left h3[/b] {
existing h2 rules in here
} if that does it try removing the h2 rule and , also take a look through the whole stylesheet and see if there are *any* h3 rules.. at the start of a stylesheet it's sometimes worth putting general "reset" rules so that you then get control of your frequently used elements.
e.g.
h1, h2, h3, h4, h5, h6 {margin: 0;} don't think it's a good idea to try and tweak the the UI code to match the CSS unless you're more confident with that, the CSS tweaks would be much easier for maintaining upgrades to core WP code/widgets/modules etc.. IMHO