473,804 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Internet Explorer won't hide nested paragraphs

Hi all,

On my site I have a section of code that resembles the following:

<p id="gear" style="display: none;">
<p>test</p>
</p>

This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?

Mar 11 '07 #1
16 3793
VK
On Mar 11, 7:12 pm, "danep" <danepow...@gma il.comwrote:
Hi all,

On my site I have a section of code that resembles the following:

<p id="gear" style="display: none;">
<p>test</p>
</p>

This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?
You cannot nest paragraphs: each P element ends up by meeting closing
</ptag or by meeting opening tag of any other block element
including another P - whatever comes first. This behavior by design
and by standards. If you really need to nest block elements, don't use
P, use other elements - say DIV.

Mar 11 '07 #2
On Mar 11, 11:26 am, "VK" <schools_r...@y ahoo.comwrote:
On Mar 11, 7:12 pm, "danep" <danepow...@gma il.comwrote:
Hi all,
On my site I have a section of code that resembles the following:
<p id="gear" style="display: none;">
<p>test</p>
</p>
This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?

You cannot nest paragraphs: each P element ends up by meeting closing
</ptag or by meeting opening tag of any other block element
including another P - whatever comes first. This behavior by design
and by standards. If you really need to nest block elements, don't use
P, use other elements - say DIV.
Thanks, I changed the outer one to a DIV and it does the trick, though
it required rewriting a lot of CSS. Strange, if what you say is true,
that for once IE conforms to standards and FF doesn't.

Mar 11 '07 #3
danep schreef:
Hi all,

On my site I have a section of code that resembles the following:

<p id="gear" style="display: none;">
<p>test</p>
</p>

This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?
When I try this at home,
using Firefox,
the word test is still displayed

--
Rob Waaijenberg
Mar 11 '07 #4
VK
On Mar 11, 7:36 pm, "danep" <danepow...@gma il.comwrote:
You cannot nest paragraphs: each P element ends up by meeting closing
</ptag or by meeting opening tag of any other block element
including another P - whatever comes first. This behavior by design
and by standards. If you really need to nest block elements, don't use
P, use other elements - say DIV.

Thanks, I changed the outer one to a DIV and it does the trick, though
it required rewriting a lot of CSS. Strange, if what you say is true,
that for once IE conforms to standards and FF doesn't.
Hard to believe but it happens as well :-)
I guess it is because Gecko browsers have to accommodate XHTML rules
as well atop of HTML with possible "Appendix C trickery" thus fell-
formed XHTML served as text/html. Just a speculation from my side.

Mar 11 '07 #5
danep wrote:
>>
<p id="gear" style="display: none;">
<p>test</p>
</p>
This renders fine in Firefox (that is, nothing is displayed).

Thanks, I changed the outer one to a DIV and it does the trick, though
it required rewriting a lot of CSS. Strange, if what you say is true,
that for once IE conforms to standards and FF doesn't.
Because you did not provide an URL, there is no definitive way to say
why FF displays as you expected. A likely reason is that you are missing a
DTD (doctype), using an invalid one, or XHTML.
Also your example was invalid implying other invalid markup.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Mar 11 '07 #6
On Mar 11, 4:12 pm, "danep" <danepow...@gma il.comwrote:
On my site I have a section of code that resembles the following:

<p id="gear" style="display: none;">
<p>test</p>
</p>
Invalid.
This renders fine in Firefox (that is, nothing is displayed).
So it error corrects and happens to do what you want.
However, in Internet Explorer, "test" is still printed.
So it error corrects and does something other than what you wanted.

Mar 11 '07 #7
In article <11************ **********@8g20 00cwh.googlegro ups.com>,
"danep" <da********@gma il.comwrote:
On Mar 11, 11:26 am, "VK" <schools_r...@y ahoo.comwrote:
On Mar 11, 7:12 pm, "danep" <danepow...@gma il.comwrote:
Hi all,
On my site I have a section of code that resembles the following:
<p id="gear" style="display: none;">
<p>test</p>
</p>
This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?
You cannot nest paragraphs: each P element ends up by meeting closing
</ptag or by meeting opening tag of any other block element
including another P - whatever comes first. This behavior by design
and by standards. If you really need to nest block elements, don't use
P, use other elements - say DIV.

Thanks, I changed the outer one to a DIV and it does the trick, though
it required rewriting a lot of CSS. Strange, if what you say is true,
that for once IE conforms to standards and FF doesn't.
Not really strange. If your HTML is invalid (and a P within a P is
always invalid) then any browser has to handle the problem as an error
condition. There is no standard for handling errors, which is part of
the reason so many people here say you must supply validated HTML.

--
http://www.ericlindsay.com
Mar 11 '07 #8
In our last episode,
<11************ **********@p10g 2000cwp.googleg roups.com>, the lovely and
talented danep broadcast on comp.infosystem s.www.authoring.html:
Hi all,
On my site I have a section of code that resembles the following:
><p id="gear" style="display: none;">
<p>test</p>
</p>
This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed. It appears
that the inner <pdoes not inherit the "display: none;" property or
somesuch. Is there a way to force IE to hide the nested paragraphs
without specifically specifying "display: none;" in every single one?
A paragraph containing a paragraph is not valid, and in fact, in HTML 4.01,
it is impossible since the second <pis presumed to close the first
P element. Your markup (not "code" because HTML is a markup language, not
a programing language --- the ML stands for markup) is invalid because it
has an extra </p>. Whatever a browser does with invalid markup is okay;
after all you broke your document by using invalid markup. IE did the
right thing and assumed the extra </pwas an error. Firefox did the right
thing because it happened to guess what you might have meant to.

You do not always get consistency when you have a valid document. But you
cannot expect consistency at all when you do not have a valid document.

Bottom line: P is a block element that cannot contain any block element.
You cannot nest P. Why in the world would you think that you could?

--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 680 days to go.
Mar 11 '07 #9
On 11 Mar, 16:12, "danep" <danepow...@gma il.comwrote:
On my site I have a section of code that resembles the following:

<p id="gear" style="display: none;">
<p>test</p>
</p>

This renders fine in Firefox (that is, nothing is displayed).
However, in Internet Explorer, "test" is still printed.
I was surprised to see your claim here that FF displays nothing and so
renders this incorrectly. I then tried it out myself (with an
appropriat page header added) and AFAICS, FF is correct and does show
"text".

Of course I should have simply ignored your posting as:
* It discusses complicated rendering behaviour
* It's a posted example, not a live URL
* It's a partial fragment.

Any of these is reason that we need to see exactly what you're seeing,
otherwise we just can't expect to see the same behaviour. Which
doctype did you use? Which doctype declaration? Which content-type?
As to why it does all this, then it's quite simple. However it's an
SGML parsing issue, not an invalid code issue. Although error
correction mechanisms in each browser are (legitimately) potentially
different, they all ought to parse valid SGML correctly even if this
doesn't mean quite what the author intended.

<pcan't nest a <pinside it, so the start of the 2nd <pimplictly
closes the first one. It's not "nested" and so the display property
obviously isn't (and shouldn't be) inherited.
It's still valid though (there are plenty of valid pages without a
single </pend tag anywhere near them).

Compare these instead:

<p style="display: none;">
<p>test</p>.

<div style="display: none;">
<p>test (div)</p>
</div>

See the difference? Try looking with the FF DOM Inspector

These are still valid HTML and are sufficient to give the behaviour
that has puzzled you. They're not _invalid_ until we encounter the
second </p>, which is an end tag to an element that has already been
closed.

Browsers may well vary in how they handle this spurious end tag
(another reason to use valid code). However explaining your specific
issue doesn't require invalidity.

Mar 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1631
by: Alexander Fischer | last post by:
Hello folks, once again, I'm asking you for support: as described in my post of June 19, IE6/Win does not show a scroll bar even though it would be required if we have an absolutely positioned element within a relatively positioned one. (See http://home.pages.at/afishh/buggy1.htm, the text on the right sidebar will not be fully visible in smaller browser windows. Please also note the yellow background of the main paragraphs.) Neal gave...
1
629
by: Ashvin Navare | last post by:
Hi, We want to disable BACK & FORWARD button of the browser so that user is forced to navigate through the menu options provided in the site. The browser used is Internet Explorer only. Please suggest some solution or any other alternate approach. Early response is appreciated. Regards,
2
1494
by: DeadlyTedly | last post by:
Hi, I'm attempting to make use of nested object tags (in HTML) as per the w3c standard here: http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3.1 This details the HTML 4.01 Specification with regard to object tags. When I create a nested object in an ASP page, I get the following server error:
4
2349
by: Nicolás Castagnet | last post by:
Hi, I write this post because I notice a strange behavior related with "Temporary Internet Files" and maybe some of you can help me to understand it. I am working in a web application with ASP.NET. Recently, I group of user have problems with it because the values of the sessions were not stored correctly (the application save the username in a login page, then other page try to get it and the result was always ""). We restart the web...
9
3118
by: Jensen bredal | last post by:
Is there any way i can view my web page in full screen mode? F11 still hhas the internet explorer tool bar. Many thanks in advance JB
7
5760
by: imad.sabonji | last post by:
HI I am using Visual Studio.Net 2003 and using C# I would like to know how is it possible to change the Internet explorer window title? ie. i want to get rid of "Microsot Internet Explorer" that appears after my application name on the title bar and if possible, get rid of the IE logo at the start of the address bar.
28
3598
by: Neo Geshel | last post by:
NOTE: PAST EXPERIENCE HAS SHOWN ME THAT MANY ON USENET FAIL TO READ ARTICLES PROPERLY PRIOR TO ANSWERING. I AM LOOKING FOR VERY SPECIFIC INFORMATION, THEREFORE PLEASE READ AND UNDERSTAND THOROUGHLY BEFORE RESPONDING; OR ASK QUESTIONS TO CLARIFY. I *WILL* APPRECIATE ANY CONSTRUCTIVE REPLY. Greetings! I am in the process of creating a template for a site. The site will be *true* XHTML 1.1. That is, it will validate as XHTML 1.1 on...
7
2733
by: Danny | last post by:
Hello: I would like to develop a browser extension, or whatever such a thing is classified as, that would allow a user of IE6, and possibly IE7, to switch between a live and development page. I'm sure the individuals reading this are familiar with what I'm referring to; however, I'll provide an example.
5
1719
by: gray_slp | last post by:
I am designing a web survey using surveymonkey.com and discovered I could use javascript to modify their standard question formats much the same as can be done in myspace. I used this feature to insert a weight converter into my survey. Unfortunately this script works fine in firefox v.2 but does not cooperate with the surveymonkey software when used with internet explorer v.6. Can someone explain to me in simple terms why the script...
0
9705
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10323
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.