Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
I am really getting mad at HTML.?
Alright, so I have been doing web development for a while now. One thing I could never do(and could never find a website telling me how to do) was make multiple messages on a single line using <marquee>. And this truly bugs me. I can't get over this and I really want it to be done. In a game called Combat Arms, important messages and megaphones get broadcast using marquee, but they get put up one after the other. Now my issue is that I can get them on the same line, but they are shown at the same time and collide with each other. This is what I've got:
<div style="background-color:grey;border:1px solid black;padding:10px;">
<table width="100%">
<td><span style="color:aqua"><marquee behavior="scroll" direction="left"><b>Please visit <a href="http://yahoo.com/%22%3Ehere%3C/a%3E for support!</b></marquee></span></td>
<td><span style="color:aqua"><marquee behavior="scroll" direction="left"><b>If you can not solve your issues, don't be afraid to make a thread.</b></marquee></span></td>
</table>
</div>
I changed the URL for the Community Guidelines.
But anyway, I just want them to be on the same line, but one gets displayed right after the other. Also, I can't link to the website I'm putting it on because it contains material that is not allowed by the Community Guidelines. If you think you can help me, go ahead. If you know nothing, don't reply. Btw, I've just started doing HTML again after a very long break. When I got back, I was experimenting with HTML5(made some cool things already) and I had no intentions of using anything below HTML5. However, vBulletin has issues and absolutely hates me so I don't have much use for HTML5 with it yet.
2 Answers
- Leo DLv 67 years agoFavorite Answer
@Reserved: I'll be replying to this in a bit.
@Edit: Sorry about the wait :)
Here are things that you're doing incorrectly:
- Using Marquee.
- Using in-line styles.
- Using a table based layout. (Tables are used for tabular data, i.e: graphable data. There is nothing graphable about this data.)
- Using table@width. (The fact you set it to 100% is a hint that you didn't need a table.)
- Abusing the <b> element.
- Unnecessarily using <span>.
- Non contextual label for an anchor like "here". (Copy the link into notepad. Now guess: Where are you going?)
@Edit: (2nd though, I missed that last part, you may want to do the other answerer's NbSp thing combined with mine. I might be able to come up with a solution, but it'll take a while, and I've ran out of space.)
Don't ever use Marquee. It's not part of HTML. It isn't well supported. It was made by browser vendors, and it was a huge mistake. This is actually the first time I've seen some one seriously suggest that they used it :P (Where did you even learn to use that?)
Use HTML for content, structure and meta-data.
Use CSS for styling. Keep all style here.
Use Javascript for behaviour. Keep all behaviour here.
Marquee is somewhat like a blend of style and behaviour.
This is what that HTML should look like: http://pastebin.com/gbedNs8h
This is clean, simple, and maintainable. I used a footer because it sounded like it was a footer, but if it's something else, just replace <footer> with that something else. The ID I used was "support" because it sounds like support information.
Then you can use CSS style sheet (put it in a separate file and link to it) to style it: http://pastebin.com/w4RHKXxw
Note: I assumed 16px font. However, the padding should be specified with ems for vertical units, percentages for horizontal units.
Generally use ems for vertical units and upper limits on widths; percentages for all remaining horizontal units; ems or pixels for borders and outlines (it really depends on what they're for), pixels for the root element's margins (keep them small, 8px is usually enough), lower limits on widths, heights.
Your main content should have an explicit max-width which your percentage units are going to be based on. It should be about halfway between 2 and 3 upper-case alphabets in a font of your choosing. Try out different sizes and pick the one that looks best to you.
Pixels are rarely used, but come in handy with some animations.
Last, I really really really recommend against it, but you can use Javascript to marquee. The big advantage of JS is it keeps your mark-up legible and clean, and can be turned off if it gets annoying. As a rule do NOT animate any thing on your page without the user's permission. In my example, I speed up the scroll until it's all visible then stop when the user hovers over it. I also provide a start/stop button.
The script is in three parts:
- A library: http://pastebin.com/bqvTu8Fm (place as last line in the document head)
- A closure: http://pastebin.com/embz2e47 (place as last line in the document body)
- A style sheet: http://pastebin.com/0NNAEFbA (holds all static styles, should name "marquee-style.txt" and in same directory as the closure.)
Always put library scripts as the last line of the head. Always put closures and things that operate on the body of the document as the last line of the body. This ensures that priority scripts are defined before needed, but low priority scripts don't load too early.
The library makes a namespace comYahooAnswersPuckettTim .base for all of your common commands to minimize polluting the global namespace. I picked a long name that can be identified back to you. You can pick a different name if you want. Generally, it's the reverse URL of your website according to Java practices.
The style sheet is very barebones. You can add things to it, just make sure they're things that will only be part of the marquee(s). Use your general style sheet for every thing else. E.g: You can use "marquee-style.txt" to style the start/stop button.
This can easily be adapted to operate on multiple elements by doing these things:
- Make the closure into a library with a name space, perhaps comYahooAnswersPuckettTim .marquee.
- Add a parameter, el, to accept any element and replace document.getElementById("support") with (el).
- Rename variables for clarity of code.
- Edit the style sheet, maybe make the script add a className to each marquee parent and use that instead of #support in the style sheet.
- Make a closure that calls addMarquee for every element by ID that needs a marquee.
If you would like explanations, be sure to email me :)
You should see the advantages right away. This is opt in and useable for the user, and infinitely more customizable by the admin. Hope this helps! :)