View Full Version : Issues with margin-left

11-15-2007, 04:49 AM
Hi everyone!
Haven't seen you guys in a few months now..
Today the problem seems to me a bit unreasonable, but here it goes:

I'm working on my own website now, 1 column, 100% height, footer sticks to the bottom. Everything looks perfect, except for one small issue.

.part_text {
margin: 0 30px;
padding: 0;
This is supposed to style this part of my code:

echo "<h2 class=\"title\">$title</h2>";
echo "<span class=\"part_text\">" . substr($text,0,200) . "... <a href=\"articles.php?id=$id\">[more]</a></span><br />";
echo "<span class=\"date\">$date</span>";

The problem is that the first line of the text appears as intended, with the 30px margins, but the following lines don't. They insist on sticking to the border.
I'm sorry for not having an online version of it, I don't have a host yet. But I'm linking a shot of what's happening. If you need more details, let me know.
http://img214.imageshack.us/img214/2193/errorew9.th.jpg (http://img214.imageshack.us/my.php?image=errorew9.jpg)

Thanks for helping!

11-15-2007, 02:03 PM
span.part_text {
padding: 0 30px 0 30px;


span.part_text {
padding-left: 30px;
padding-right: 30px;


span.part_text {
margin: 0 auto;
width: 95%;

I know you were just trying to do it shorthand but I have had problems with that too. the only time shorthand has seemed to work for me is when you use it to center as in the last definition

11-15-2007, 09:58 PM
I tried your suggestions, but they didn't work as well. I tried the same structures using margin instead of padding, but nada.
The centering part didn't work, the text sticks to the border.
Still looking for a solution.

11-17-2007, 10:14 PM
Hi everyone.
I was just wondering: could this problem be related to how the instructions are ordered?
Thanks for any clarifications.

11-18-2007, 05:17 AM
Just to let you people know that I have the answer for the problem. The thing was that I was using span to show the text, which is an INLINE element. I should have used a BLOCK element, like p. I tried it and it works now.