oboedrew
07 May 2008, 03:21 PM
Hello, everyone. I'm relatively new to xhtml/css and I'm running into a problem with margins.
Here is the relevant code:
XHTML:
<div id="mp3s">
<p>Testing</p>
<a href="testing.mp3"><img src="mp3icon.gif" /></a>
<p>More Testing</p>
<a href="moretesting.mp3"><img src="mp3icon.gif" /></a>
</div>
CSS:
div#mp3s
{position: relative; top: 80px; margin: auto;
letter-spacing: 1px; word-spacing: 1px;
font-size: 20px; font-family: "times new roman", times, serif}
div#mp3s a
{margin: 0 auto 20px}
This is from a page of my website where I plan to make some mp3's of my music available. Underneath the name of each song is an icon that acts as the link to that song. The problem is, right now, there is an equal amount of space between the each song title and icon. I want to set it up with a little extra space between the bottom of one icon and the top of the next song title, just so it looks less cluttered and so that it's easy to tell that the links/icons correspond to the song titles ABOVE them, not below.
I thought I would be able to achieve this by changing the margins as shown at the bottom of the CSS sampled above. But when I view it in my browser, no matter what I set as the margins of "div#mp3s a," the appearance on screen does not change.
Can someone explain what I'm missing here? I would be most open to any suggestions, as I've only been studying XHTML/CSS about a week, so I'm sure there are things I'm doing that could be done more effectively and/or efficiently another way.
Thanks,
Drew
Here is the relevant code:
XHTML:
<div id="mp3s">
<p>Testing</p>
<a href="testing.mp3"><img src="mp3icon.gif" /></a>
<p>More Testing</p>
<a href="moretesting.mp3"><img src="mp3icon.gif" /></a>
</div>
CSS:
div#mp3s
{position: relative; top: 80px; margin: auto;
letter-spacing: 1px; word-spacing: 1px;
font-size: 20px; font-family: "times new roman", times, serif}
div#mp3s a
{margin: 0 auto 20px}
This is from a page of my website where I plan to make some mp3's of my music available. Underneath the name of each song is an icon that acts as the link to that song. The problem is, right now, there is an equal amount of space between the each song title and icon. I want to set it up with a little extra space between the bottom of one icon and the top of the next song title, just so it looks less cluttered and so that it's easy to tell that the links/icons correspond to the song titles ABOVE them, not below.
I thought I would be able to achieve this by changing the margins as shown at the bottom of the CSS sampled above. But when I view it in my browser, no matter what I set as the margins of "div#mp3s a," the appearance on screen does not change.
Can someone explain what I'm missing here? I would be most open to any suggestions, as I've only been studying XHTML/CSS about a week, so I'm sure there are things I'm doing that could be done more effectively and/or efficiently another way.
Thanks,
Drew