Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Problem with paragraphs

While working through the course I am using my own editor just to practice and build a site as I go along. for some reason with paragraphs <p>text</p>, I am not getting any line spacing between paragraphs. Anyone know what the problem might be? I have tried various browsers.

6 Answers

Posting your markup would help, but if you are trying to add line breaks inside a <p> tag with just a return carriage, it will not recognize them. You either need to make a separate tag for each paragraph you want, or else use the br tag to create an HTML line break.

Reference link W3Schools

Here is my code:-

<div class="section1"> <div class="mainText">

                <h1>Welcome to Suyo Hairdressing in Birmingham....</h1>
                <p>Looking for something different? Welcome to Suyo Hairdressing, a contemporary hair salon in the heart of Harborne.</p>
                <br ?>
                <p>Adrian and Terence, two of Birmingham’s most respected hairdressers, lead a highly-experienced, award winning, creative team. Clients love the exceptional hairdressing and friendly welcome. Why not visit our hair salon and experience all we have to offer first-hand?</p>
                <h2>One of Birmingham's premier hair salons</h2>
                <p>Perfectly situated in the heart of Harborne village, just outside Birmingham centre. Combine a visit to Suyo Hairdressing with a spot of shopping, or for some well deserved pampering on the way home from a long day in the city.</p>
                <p>Powerful, wearable styles with an urban edge, the highest standards of professionalism and client care with second-to-none service. All in a contemporary, relaxing atmosphere. This is Suyo. To book today call 0121 427 3229.</p>

                <h2><i>Suyo... something different.</i></h2>

            </div><!-- END Of mainText -->


        </div> <!-- END OF SECTION! -->

Here i my code, or part of it -

<div class="section1"> <div class="mainText">

                <h1>Welcome to Suyo Hairdressing in Birmingham....</h1>
                <p>Looking for something different? Welcome to Suyo Hairdressing, a contemporary hair salon in the heart of Harborne.</p>
                <br ?>
                <p>Adrian and Terence, two of Birmingham’s most respected hairdressers, lead a highly-experienced, award winning, creative team. Clients love the exceptional hairdressing and friendly welcome. Why not visit our hair salon and experience all we have to offer first-hand?</p>
                <h2>One of Birmingham's premier hair salons</h2>
                <p>Perfectly situated in the heart of Harborne village, just outside Birmingham centre. Combine a visit to Suyo Hairdressing with a spot of shopping, or for some well deserved pampering on the way home from a long day in the city.</p>
                <p>Powerful, wearable styles with an urban edge, the highest standards of professionalism and client care with second-to-none service. All in a contemporary, relaxing atmosphere. This is Suyo. To book today call 0121 427 3229.</p>

                <h2><i>Suyo... something different.</i></h2>

            </div><!-- END Of mainText -->


        </div> <!-- END OF SECTION! -->

Here i my code, or part of it -

<div class="section1"> <div class="mainText">

                <h1>Welcome to Suyo Hairdressing in Birmingham....</h1>
                <p>Looking for something different? Welcome to Suyo Hairdressing, a contemporary hair salon in the heart of Harborne.</p>
                <br ?>
                <p>Adrian and Terence, two of Birmingham’s most respected hairdressers, lead a highly-experienced, award winning, creative team. Clients love the exceptional hairdressing and friendly welcome. Why not visit our hair salon and experience all we have to offer first-hand?</p>
                <h2>One of Birmingham's premier hair salons</h2>
                <p>Perfectly situated in the heart of Harborne village, just outside Birmingham centre. Combine a visit to Suyo Hairdressing with a spot of shopping, or for some well deserved pampering on the way home from a long day in the city.</p>
                <p>Powerful, wearable styles with an urban edge, the highest standards of professionalism and client care with second-to-none service. All in a contemporary, relaxing atmosphere. This is Suyo. To book today call 0121 427 3229.</p>

                <h2><i>Suyo... something different.</i></h2>

            </div><!-- END Of mainText -->


        </div> <!-- END OF SECTION! -->

The break tag is

<br />

not

<br ?>

The break isn't the issue; I am not getting paragraph spacing between the paragraphs.

Hmm not sure. When I paste your html into a CodePen, the paragraphs space as expected. Do you have a stylesheet like normalize.css or something else on your page that would remove all standard browser formatting?

No, I have no style sheet with normalize. This is bizarre!! I am correct in thinking there is a line space between paragraphs, without the use of a <br />?

My message should show a code break; it keeps converting to a question mark!!

Thanks everyone for your help. I managed to find the problem. I had set margins to 0 as a universal selector. I would never have thought this would have affected the spacing.