473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Closing paragraph tags being ingnored

KeredDrahcir
426 256MB
I'm wondering if anyone can help me. I'm getting validation errors where I'm told I'm trying to open a div inside a paragrpah.
I'm closing the paragrpah before I open the div but for some reason the validator doesn't see the closing p tag ans when I view source, the browser doesn't see it.
It's quite definatly in the code.
Expand|Select|Wrap|Line Numbers
  1. <div class="my class">
  2.   <p style="text-align: center;">
  3.     <br />
  4.     <a href="javascript:void(0)" onclick = "my script">
  5.       <img width="225" height="228" src="my image" alt="" />
  6.     </a></p>
  7. <div style="position: fixed; top:50px; left: 25%;">My content</div></div>
That is my code but the closing p tag after the closing a tag goes missing. It does it more than once.
Feb 28 '12 #1

✓ answered by KeredDrahcir

I need to use the self-closing tags because I'm using XHTML. I know that the code should validate but the browser missed out the closing paragraph tag. I get it in Internet Explorer, Firefox, Safari, Google Chrome and Opera.

I did fix it using a division instead of a paragraph but I don't want to have to that every time and would like to know why it happens. Any other ideas?

10 2015
drhowarddrfine
7,435 Expert 4TB
Which browser? That should validate so it depends on what's going on before that.

I wouldn't be using XHTML self closing tags like <br /> or <img/> in HTML markup cause it's unnecessary and sometimes leads to problems.
Feb 28 '12 #2
KeredDrahcir
426 256MB
I need to use the self-closing tags because I'm using XHTML. I know that the code should validate but the browser missed out the closing paragraph tag. I get it in Internet Explorer, Firefox, Safari, Google Chrome and Opera.

I did fix it using a division instead of a paragraph but I don't want to have to that every time and would like to know why it happens. Any other ideas?
Feb 29 '12 #3
drhowarddrfine
7,435 Expert 4TB
the browser missed out the closing paragraph tag. I get it in Internet Explorer, Firefox, Safari, Google Chrome and Opera.
Sounds like you're contradicting yourself. I don't see the problem.
Feb 29 '12 #4
KeredDrahcir
426 256MB
I meant I get the problem.

This is my code:
Expand|Select|Wrap|Line Numbers
  1.     <div class="my class">
  2.       <p style="text-align: center;">
  3.         <br />
  4.         <a href="javascript:void(0)" onclick = "my script">
  5.           <img width="225" height="228" src="my image" alt="" />
  6.         </a></p>
  7.     <div style="position: fixed; top:50px; left: 25%;">My content</div></div>
  8.  
This is what the browser shows:
Expand|Select|Wrap|Line Numbers
  1.     <div class="my class">
  2.       <p style="text-align: center;">
  3.         <br />
  4.         <a href="javascript:void(0)" onclick = "my script">
  5.           <img width="225" height="228" src="my image" alt="" />
  6.         </a>
  7.     <div style="position: fixed; top:50px; left: 25%;">My content</div></div>
  8.  
Notice the difference on the second to last line.
Feb 29 '12 #5
drhowarddrfine
7,435 Expert 4TB
I just don't see that. Perhaps your script is doing something?
Feb 29 '12 #6
KeredDrahcir
426 256MB
Do you notice that the closing paragrpah tag afer the closing anchor is missing in the second piece of code?
If you're asking if the onclick script is affect it, then I can be sure that it isn't all it does it changes the display values of two divisions.
Feb 29 '12 #7
drhowarddrfine
7,435 Expert 4TB
Yes I saw that but I don't see the problem in any browsers myself.
Feb 29 '12 #8
KeredDrahcir
426 256MB
So you have no idea what's causing it for me? Is that correct?
Feb 29 '12 #9
drhowarddrfine
7,435 Expert 4TB
Yep .
Feb 29 '12 #10
KeredDrahcir
426 256MB
Thanks. I'll let you know if I sort it.
Mar 1 '12 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: LPA | last post by:
Hi, I have a function to take the 300 first words of a db field. As this field contains HTML, if some tags are not closed (TABLE, TD, TR, SPAN, DIV, P, ....) the presentation is out. Is...
3
by: Jean-Fran?ois Lacrampe | last post by:
Hello, I want to write a _very_ simple text parser that would replace a string like: "This is text with /italics/, *bold* and _underline_." and generate automatically something like this: ...
8
by: Peter van Schie | last post by:
Hi all, Give an xml document that looks something like this: <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl"...
3
by: Grant Harmeyer | last post by:
I have an XSL file that is being applied to an RSS feed, and it works great except for 2 things: 1.) XSL doesn't close the <img> tag for xhtml even though I have it being closed in the XSL file...
20
by: AndyZa | last post by:
Is the following html valid? <p><hr width="50%"></p> Or would the following be more "technically correct"? <p> <hr width="50%"> Do I require the closing </p> tag?
4
by: Mark Rae | last post by:
Hi, Is there a way to prevent ASP.NET 2 from stripping off the self-closing meta tags...? E.g. <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1" /> is turned into
4
by: basm101 | last post by:
Hello, I need to know how to create closing tag elements when using DOM to add in form elements to a page. Here is the code...the <div> I am adding to the page is called dropDownList (for...
1
by: dhruvbaruah | last post by:
Hi I'm working on a classified website. The problem i'm facing is that in the Place an AD I have a section where you put the description of the product. The problem is even if the user puts paras...
1
by: Hvid Hat | last post by:
I'm using <xsl:copy-of select="content" /on the following XML: <?xml version="1.0"?> <content> <p></p> <p>This is a paragraph</p> <p></p> <p>This is another paragraph</p> </content>
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.