Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 20th, 2006, 07:47 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Span Bug?

Hi all,

Here's the markup:

<span id = "Sum" class = "foodlabel" style = "background:gold; color:black; font:12px tahoma; border-left: 1px solid black; border-right:1px solid black;">

    <button name = "addFills" onclick = "addFills(document.getElementById('iBloom'), document.getElementById('iBap'), document.getElementById('iPan'), document.getElementById('iBag'), document.getElementById('imgRoll'))">Add Fillings</button>

</span>

This was working fine until I added the following markup:

<form name = "hiddenForm" style = "position:absolute; padding:1; margin-left:1; left:219px; top:50px">
                        <select name = "bloomSelect">
                        <option value = 0 selected>Please make a selection
                                <option value = 1>Cheese
                                <option value = 2>Cheese & Ham
                                <option value = 3>Cheese & Tomato
                                <option value = 4>Cheese & Bacon
                                <option value = 5>Bacon & Tomato
                                <option value = 6>Ham & Tomato
                                <option value = 7>Ham & Brie
                                <option value = 8>Tuna Mayonnaise
                                <option value = 9>Tuna Melt
                                <option value = 10>Chicken Bacon & Sweetcorn
                                <option value = 11>Tuna Cheese & Sweetcorn
                                <option value = 12>Speciality Fillings
                        </option>
                        </select>
</form>

What happened next was that sometimes when the page was reloaded either one or both of the above elements disappear and reappear every so often (usually every two or three reloads). Is there something in my markup thats causing it or is there a bug?

Cheers
Joe

__________________
\'sync\' &lt;cr&gt;
The name specified is not recognized as an internal or external command, operable program or batch file.
Reply With Quote
  #2 (permalink)  
Old June 20th, 2006, 07:52 AM
Authorized User
 
Join Date: Aug 2003
Location: Schuylerville, NY, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your code:
Code:
<form name = "hiddenForm" style = "position:absolute; padding:1; margin-left:1; left:219px; top:50px">
seems to have some misinformation in it. Why do you have margin-left, left, and top?

According to all of my CSS books, "left" and "top" are not correct. They should be either "padding-left" and "padding-top" or "margin-left" and "margin-top".

I don't know how far that will get you, but it's just something I noticed right off. Good luck!

HollyAnn
aka Scottiegirl

"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die." - Calvin, Calvin and Hobbs
Reply With Quote
  #3 (permalink)  
Old June 20th, 2006, 08:12 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi HollyAnn,

The 'left' attribute says this:

Position the left hand edge of the element x amount of pixels (or whatever measurement you choose) from the left hand edge of the screen (absolute positioning, HTML and CSS gurus feel free to jump in here). This is the same for Top, Right and Bottom. As far as I was aware there shouldn't be a problem using these attributes inside a Form's style attribute. But you're probably right that I shouldn't use margin-left alongside left. I was under the impression that margin-left set the amount of pixels between the left hand edge of the element and its nearest element to the left? So I was trying to say:

Put my element 219px from the left edge of the screen and keep a 1px margin between my element's left edge and its closest element to the left. Am I doing this wrong?

Thanks for your help.

Reply With Quote
  #4 (permalink)  
Old June 20th, 2006, 09:34 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You're missing units of measurement here:
position:absolute; padding:1; margin-left:1; left:219px; top:50px

padding: 1, works in IE, but doesn't work in any other browser becuase the standard says that a unit is required. So that should be padding: 1px;, margin-left: 1; should also be margin-left: 1px;

Do you have a link to a live, functioning document? It sounds like the peek-a-boo bug, but I can't say for sure without actually seeing it.

I'm also quite sure that markup doesn't validate. Run it through http://validator.w3.org and fix any errors it complains about.

There are loads of IE rendering bugs documented at http://www.positioniseverything.net and http://www.quirksmode.org

HTH!

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
Reply With Quote
  #5 (permalink)  
Old June 20th, 2006, 09:40 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

HollyAnn, "left" and "top" are offset properties, which typically accompany positioned (layered) content. Read more about them here:

http://www.w3.org/TR/CSS21/visuren.html#position-props

top, right, bottom, and left are applied from the outside margin edge of a positioned element (an element with relative, absolute, or fixed position, as opposed to static). You can actually use either margin or the offset properties or any combination thereof to adjust an element's position.

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with <span> tag tclotworthy XSLT 2 February 18th, 2007 03:48 PM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Span tags not working Netscape apd8x Javascript 4 January 27th, 2005 06:11 AM
span tag with code behind jtyson General .NET 3 April 22nd, 2004 02:50 PM
Bug happens guoqi BOOK: ASP.NET Website Programming Problem-Design-Solution 0 October 13th, 2003 01:35 PM



All times are GMT -4. The time now is 06:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.