How To Stop Lists From Indenting
-
If you go to my site you’ll see that my links and comments are indented. I think in place of bullets it’s just indenting everything. Is there anyway I can get around this? I removed the bullets by putting list-style-type: 0; in my CSS. Maybe there is a more professional way?
-
Hi, in your CSS stylesheet, you can do something like this:
ol.commentlist {
margin-left:0;
}This should remove the left indentation from your comments list.
Thanks Tony but it doesn’t work.
try changing ol to ul.
Truthfully, there’s nothing “unprofessional” about setting the list-style or list-style-type to “0” or “none”. Works fine, and is perfectly valid, and if it gave you the look you want, don’t worry about it.
Actually the problem why I think it’s not professional is because it doesn’t work. Yeah, it got rid of my bullets but it’s still indenting my lists. Check out my links page to see what I mean. I want my lists to be aligned to the left side of the page like all my headings and content.
5thape, try this:
#content ul, #content li {
list-style-type: none;
padding-left: 0;
}On that particular page (Links) there are several problems:
The template tag spits out “li id” for every link category
(e.g.<li id="linkcat-6">
) and those are not styled;
and the links themselves are embedded lists inside those.
Furthermore the<ul>
tag is missing on the page at the beginning, so it gives errors, too… besides not “listening” to the instructions of the stylesheet.Kafka, thanks so much that solved the problem.
Moshu, I think the problem might come from my links.php in my wp-includes folder. At the bottom of that file is all the script for the get_links_list command which I use to display my links. In my links.php file in my theme folder I’ve added opening and closing ul tags and that got rid of 7 out of 14 XHTML errors:
< ul ><?php get_links_list(); ?> < /ul >
All the rest of the 7 errors say that “element ‘linkcat’ undefined”. What could I do to fix that? Thanks.
I use the same template tag on a link page, but… your output is different:
<li id="linkcat-6"><linkcat>Film & TV</linkcat>
The validator doesn’t like those <linkcat></linkcat> things – which I have no idea where are coming from.
WP generates (I think) only the
id="linkcat-6"
part. So, how did you get those strange “tags”?lol I have no clue…I’m not proficient enough in PHP to start adding things and I’m usually very careful about not accidentally adding things. Do you think I should get a new links.php file and overwrite the one I have in my wp-contents folder?
I think I found the problem. For some reason there was a <linkcat> tag inside the php, which you pointed out. I deleted it and it all validated correctly. Weird…
Thanks for your help!
edit.
Glad it worked out.
- The topic ‘How To Stop Lists From Indenting’ is closed to new replies.