[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Empty paragraph tag

Posted on 2004-11-30
12
Medium Priority
?
1,401 Views
Last Modified: 2012-08-13
Given the below:

<html>
<head>
</head>
<body>

<div id=blah style="width:500px; height:500px;border:1px solid;">
      <p/>
      <p/>
      <p>HERE</p>
      <p>some more space</p>
</div>
</body>
</html>

How can i guarantee there will be line space even for empty P tags ?  At the moment "HERE" is displayed at the very top of the page.

Thanks
0
Comment
Question by:Type25
  • 3
  • 2
  • 2
  • +4
12 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 12703932
use &nbsp; for empty space
0
 
LVL 9

Author Comment

by:Type25
ID: 12703940
I can't do that, it MUST be through CSS as the output of the html is out of my control

0
 
LVL 9

Expert Comment

by:gruntar
ID: 12704078
In HTML empty paragraph should be written like this

<p>&nbsp;</p>

Cheers
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Expert Comment

by:gruntar
ID: 12704090
You coulkd use <br /> instead paragraphs.
0
 
LVL 2

Expert Comment

by:Digga
ID: 12704286
Maybe an opening and closing p tag rather than 2 closing tags and no opening:

     <p/>
     <p/>
     <p>HERE</p>
     <p>some more space</p>

0
 
LVL 31

Accepted Solution

by:
seanpowell earned 2000 total points
ID: 12704683
Depends on the specific scenario, but this is the easiest way:

p { padding-top:20px; }

Sean
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12711290
I believe if you refer to the specifications you will find that an empty paragraph may be treated as null node.  In other words the browser is permitted to ignore it, as is the case for most empty containers.  You cannot rely on an empty paragraph to render consistently, and I think even adding padding will not change that. If the browser is actually ignoring a container that does not contain any nodes.  So if you choose to use an illogical structure instead of the br tag that is in tended for the purpose I gues you just gambol that all your users will have browser that render the way you think it should.

Cd&
0
 
LVL 2

Expert Comment

by:Digga
ID: 12711447
Good point.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 12711727
> the output of the html is out of my control
then you should complain about the person (or product) responsible for the bad html.
what are those closing p tags that are not open in the first place???
0
 
LVL 9

Author Comment

by:Type25
ID: 12713882
www.htmlarea.com  is the culprit.

it's a richtext control written in javascript.  This is one of many annoying issues with it. I would substitue all the P tags for <br> but that screws over the bulleted lists.

0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 12714544
> www.htmlarea.com 
i use that too and it seems to work fine for me.
if you manipulate the generated code, you should always make sure your html is well formed.
if you have php, you can use tidy:  http://www.php.net/tidy
tidy is quite magical, you just give it some buggy html code and it knows how to fix it.
0
 
LVL 9

Author Comment

by:Type25
ID: 12715490
I'm using the RC1 version, the previous version does work you're right, but something changed in the latest version.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 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