473,898 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox leaves blank line, IE6 doesn't

43 New Member
Hi everyone, this is my first post so I'll try to make it as clear and concise as possible.

I'm working on a PHP game and it's coming along well but as it's growing I've realized that my disgusting coding habits are catching up to me and I'm repeating code, assigning the same data to different variables and making an all-around mess of things. That's why I've decided to re-code the site and while I'm at it make sure that everything is XHTML 1.1 and CSS compliant.

You can find what I've made so far, just the beginning of a CSS layout, at http://www.antiriddle.com/test/. If you look at the page in IE6 and then FF you'll see the problem immediately. FF adds an extra line break between navtop and branding, which isn't supposed to be there. I've tried a ton of different fixes but haven't made any real progress. IE6 currently displays the page as I want it to look.

Any advice is much appreciated! Thanks in advance.
Aug 18 '07 #1
8 2276
phvfl
173 Recognized Expert New Member
Hi,

The insertion of the line is caused by the margin on the paragraph element in the branding div.

You can remove this by setting the margin of the paragraph to 0. You may find it easier to set all padding and margins to 0 using the universal selector and then putting margins and padding back on elements that require it explicitly. To set all elements to 0 padding and margin use:

* {padding:0;marg in:0;}

This also has the advantage of removing browser default padding and margins which causes some display differences between browsers
Aug 18 '07 #2
akapsycho
43 New Member
Amazing, you are god. Thank you so much for helping me fix my problem!
Aug 18 '07 #3
drhowarddrfine
7,435 Recognized Expert Expert
Never, ever use IE as a reference to how things work. It's old, buggy and non-standard. It's like saying your 1998 Ford doesn't work like your 2007 Porsche, and then you try and fix the Porsche.

First, you should not be trying to use xhtml1.1. Version 1.1 is to be served as XML only. If you are truly serving xhtml (you probably aren't) then use version 1.0. Of course, IE does not do xhtml so it's rather worthless and you should just use html4.01.

Second, you are using an id more than once. id names are only to be used once per page and unique to one element. If you must use the same styles applied to multiple elements, use 'class'.

I'm not on my dev computer so, after fixing all that, let me know what happens.
Aug 18 '07 #4
akapsycho
43 New Member
Alright well I'm going to make the change back to XHTML 1.0 Strict and I changed it to two different id's. I wasn't using IE as a reference for checking whether my code was good, but more as a reference to how I wanted it to end up looking. I'm also using PHPEdit which previews similarly to how IE6 displays it so that was messing me up. Thanks for the tips.

And what do you mean by, which I'm probably not? I'm passing it through the validator, isn't that enough? I just want something that will really separate structure from presentation which, to my understanding, is what XHTML and CSS are there for.
Aug 18 '07 #5
drhowarddrfine
7,435 Recognized Expert Expert
What I mean is, even though you declare xhtml in the doctype, your server has already declared the page as html. I just looked and, as I said, you are serving the page as text/html rather than xhtml. Most people are. So writing xhtml doesn't mean anything because all browsers will interpret it as html cause the server said it is. It's called "tag soup" and actually is read as invalid html though it works anyway.

This is the reason it works at all in IE even though IE does not work with xhtml. It thinks you are serving html and interprets it as such.

I wasn't using IE as a reference for checking whether my code was good, but more as a reference to how I wanted it to end up looking.
This you shouldn't do because even though your markup may be correct, IE is more likely to display it incorrectly. This is why you should always check your page first in Firefox or Opera. Then see if IE does it right.

IEs bugs and quirks are known, along with the fixes, so it's more important to get it right in a modern browser, then adjust for old, buggy, non-standard IE.
Aug 18 '07 #6
akapsycho
43 New Member
Alright that makes since about IE displaying things incorrectly. I'll try to make sure it works with FF first in the future. Is there any way to make my server serve it up as xhtml? Is there a problem if I keep serving it as xhtml even though it is being received as html? I would prefer to just keep going through it as xhtml so that I'm forced to write neater code.
Aug 18 '07 #7
drhowarddrfine
7,435 Recognized Expert Expert
Your server is serving it as html. The doctype is ignored. Like I said above, you can continue writing xhtml, and it will work fine but interpreted by all browsers as html.

XHTML does not force you to write cleaner code. You can write clean markup with HTML, too. The validator will tell you when you make errors in either. Browsers will still make the best of whatever you write while true XHTML won't display anything at all if there is an error.

So, in that sense, you gain nothing by writing xhtml though it doesn't hurt to do so. Others disagree and there are "may be harmful" articles on the web.
Aug 18 '07 #8
akapsycho
43 New Member
OK cool I think I'll just keep going then so that I can feel virtuous. Thanks for all of your help!
Aug 18 '07 #9

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

Similar topics

12
3296
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered text, I lose the leading blank line. Each time it goes through a post any top-leading blank line is lost. Only one- if I have several blank lines in a row at the top, only the first is lost. (If the top blank line has a single space, it's handled...
18
20537
by: Gustaf Liljegren | last post by:
IE does, and I can't remember this used to be a problem in Netscape. I guess someone in the Mozilla team just came up with a Smart Idea about the True Semantics of the Hyphen Minus character. :-( How do I make IE and Firefox agree to make hyphens trigger a linebreak? Gustaf
8
3783
by: ergobob | last post by:
Hello, I have two scroll boxes on the same page. The first scroll box is good in IE but the words will not wrap correctly in Firefox. The second scroll box is good in all browsers. You can see this on a test page at http://www.usernomics.com/ergonomic-products-accessories5.html . Can anyone see why the words will not wrap correctly in the first scroll box
5
3517
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything works fine as it also does in firefox if I call the contents frame directly (i.e. outside of its frameset). However, if I call my main page (index.html) which invokes the frame set, the contents frame javascript menubar onmouseover function...
3
2091
by: Paul | last post by:
I found a great site for CSS tempaltes, http://blog.html.it/layoutgala/ . I downloaded them, and played around with them. Then I tried to use the template in as ASP.Net MasterPage, but everything seems to break. For example, Number 13 is coded as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Layout 13</title> <meta http-equiv="content-type" content="text/html;...
5
21484
by: JulioHM | last post by:
Hi all, I'm trying to use WMP in FireFox and I have the following tag to embed the player into the html page. <EMBED TYPE="application/x-mplayer2" PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/" ID="wmp" Name="wmp"
4
5373
by: Patrick Nolan | last post by:
I am using javascript to manipulate optgroups in select elements. When the results are displayed in Firefox 2.0 there is an annoying blank line at the top of the multi-line select box. This doesn't happen with IE7. There's a little program below which illustrates the problem. I create two multi-line select boxes. The first one has an optgroup and an option specified in the HTML. That one displays with "opt1" as the first line. The...
3
2443
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a couple of the Firefox is munging up. So, on my information page there is a gridview in the content section of the page. The masterpage contains searching capabilities for the gridview. The masterpage has controls contained in a panel control,...
0
10858
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
10948
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
10484
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9662
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
8036
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
5881
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
6077
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4706
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
2
4296
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.