web dudes...how can I have a <br> in a <li>?

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
In firefox I see breaks where you have them:

<li><a href="/sounds.htm">Buy CDs</a></li>


          <li><a href="/press_photos.htm">Photos</a></li>
          <li><a href="http://rattletree.com/booking.htm">Contact</a></li> 


          <li> <a href="/phpBB3/">Forum</a></p></li>


After "Buy Cd's" and "Contact".

Mike
 
basically it doesn't want me to have a break within a list...it wants me to </ul> the list and the start a new list, but I want to use the same graphic for the buttons so I'm wondering if there is an easy way to do this that don't know?
 
Validate how?

Giving an error?

Have you tried just putting an empty line:
<li></li>

Sorry if I am not understanding.

Mike
 
Check this out:
http://csscreator.com/node/22897

Sounds like you want to use "margin" in your CSS.

"In any event spacing LI elements (or any others) out that way is bad, bad coding practice. Use CSS to put margins on your LI elements to space them. Margins are used to space elements with CSS and BR should never be used for that purpose."

This makes sense now that I read it.

Mike

Edit:
Another good link that relates:
http://www.webdeveloper.com/forum/showthread.php?t=169547
 
"validate how?"
In the w3c validator. 

Thanks for the link.  sigh...that is why I wanted to ask here because of responses like that guy that you quoted.  Yeah, I "get it" that
s are bad bad bad.  Problem is it is the only damn way I have been able to manage to achieve the seemingly simple thing I want to achieve.

The site looks exactly the way I want it to in firefox, explorer, and safari so far...I'm just not following the 'rules'

THe above page also mentions to put padding in the <ul> and not the <li> so I don't see how I can achieve what I want to do with just a margin...hmmmm
I'm glad I do soldering more than coding.  8)

 
Ahhhh I see. So you don't want space between every link...how it looks now is how you want it?

Well I'm not a pro...but I do a fair bit of web stuff.  I would not worry about validation errors.  If it works in the major browsers I'm happy.  It may not work in Netscape 2.3 but that 0.03% will be out of luck  :)

Good luck!

Sorry I couldn't be more help.

Mike
 
> how can I have a
in a <li>?


That's -not- what you are doing.

You have the BR -outside- any LI context but INside UL context.

Once you start with UL, you must let the UL renderer do all layout except INside the LI contexts, until you get to not-UL context. Anything inside UL but outside LI really should not be there.

Of course BR-abuse is very common, and most general-purpose HTML renderers "must" do what you want, not what you literally say, or too many existing pages will render "funny".

A UL list is not supposed to be spaced-out. It is a very 1991 construct, reflecting typewriter and nroff formatting.

You've gussied it up with a tart-load of CSS. My question then is: why a List? Why not just a bunch of BR, with SPAN or other invisible attribute to invoke CSS stylings?

I'm of multiple minds. I respect the way your CSS re-renders the page at many different widths while retaining plausable formatting. And the automatic "button" is too-kewl. OTOH, to my eye a dumb old TABLE 99% wide could be subdivided to give similar effect in ways that any HTML-2 renderer, or eyeball code-check, could understand quickly.
 
I don't know enough about tables to properly answer your question other than to say that most of the people I know despise tables as much as other people despise the misuse of the
so I never really learned how to use them....In the case of the list on my site, the vision came before the coding.  By having those buttons as a list, I can do those 'kewl' tricks like the sliding window buttons all using the same graphic to save bytes...again I don't know enough about tables to know how to do what i did with the list...This seems to be a case where the broken rules aren't breaking anything on any browsers (yet) maybe eventually I'll have to change it if it gets all wonked up in some future browser upgrade.  There is the nagging part of me wishing it would validate, but oh well.

The short answer of why it is a list is that it started out as a proper list with no spaces, but then I tried the spaces and liked them...
 
Maybe
needs to be written as
in html code to give web validation ?
(as it seems the page doctype is xhtml, transitional though)
 
It does need to be
I'm just using that as shorthand here...doesn't change the lack of validation though. Like PRR said, it doesn't want me to have a
within a <ul>
 
Back
Top