Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

CSS Why does margin-bottom not work in my code?

stowman

New Coder
The following code results in the three paragraphs using 'psf-body_text' being in red (which is correct) but the margin-bottom is not 99px.
Why?
===================================================
HTML:
<style>
.psf-body_text{color:red;margin-bottom:99px;}
</style>
<div class='psf-title'>TITLE OF WRITTEN FILE</div>
<div class='psf-subtitle'>Sub of written file!!!!</div>
<div class='psf-body_text'>FOIST paragraph of body text, followed by 2 newlines using nl2br.?Convert to p????<p>
<p>
2nd paragraph, ends with one newline using nl2br..<p>
3rd paragraph.</div>
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;>'</div>
 
Last edited by a moderator:
Hey there,

So I tested the code and I can see that after the psf-body_text div that there is a margin for the bottom of 99px. Was there something you were looking for in particular?

The following code results in the three paragraphs using 'psf-body_text' being in red (which is correct) but the margin-bottom is not 99px.
Why?
===================================================
HTML:
<style>
.psf-body_text{color:red;margin-bottom:99px;}
</style>
<div class='psf-title'>TITLE OF WRITTEN FILE</div>
<div class='psf-subtitle'>Sub of written file!!!!</div>
<div class='psf-body_text'>FOIST paragraph of body text, followed by 2 newlines using nl2br.?Convert to p????<p>
<p>
2nd paragraph, ends with one newline using nl2br..<p>
3rd paragraph.</div>
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;>'</div>

Also to note, on line 10 you're missing a single quote to complete the inline styling. It looks like you misplace the single quote between div and /div.

You currently have:

HTML:
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;>'</div>

It should be:

HTML:
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;'></div>
 
Hey there,

So I tested the code and I can see that after the psf-body_text div that there is a margin for the bottom of 99px. Was there something you were looking for in particular?



Also to note, on line 10 you're missing a single quote to complete the inline styling. It looks like you misplace the single quote between div and /div.

You currently have:

HTML:
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;>'</div>

It should be:

HTML:
<hr style='height:2px; width:100%; border-width:0; color:red; background-color:red; margin: 3px 0 2px 0;'></div>
Firstly, thanks for spotting the misplaced single quote.
Regarding the margin-bottom, I have solved my own problem.
Thank you anyway.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom