Solved

CSS Margin on <ul>

Posted on 2014-01-15
2
301 Views
Last Modified: 2014-01-16
Can I change the vertical spacing on the HTML <ul> element with the margin property, applied to <ul>?

For example. please look at https://www.whasocal.org/sponsor_benefitst.php.

Note the large amount of white space between the prior text & the start of the <li> items in several places.

If this can't be done with margin on <ul>, how can I do it?

Thanks
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39784274
Add to UL {}
margin:0

For the P tag remove the margins (why the negative margin?) and add

margin: 1em 0 .6em 0;

Just tweak the margin as you need.
0
 
LVL 5

Expert Comment

by:Neil_Bradley
ID: 39784375
You could use "last-child" to target the last li tag in your list.
For example
li:last-child{padding-bottom:20px}

Open in new window

This will put a nice block of padding under each of your lists and tidy up your spacing a bit..
Cheers,
Neil
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question