Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / February 2007



Tip: Looking for answers? Try searching our database.

how to break long legend tag caption into multiple lines?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dubing@gmail.com - 23 Feb 2007 01:32 GMT
Hi,

We have some html source like this:

<div class="survey">
<form action="students/cbe-graduate-students/survey.html"
method="post" id="frmPbSurvey">

<fieldset class="survey_item">
<legend class="question"><span class="questionNumber">6.</span>If the
answer to question 11 is yes, do you think they provide adequate
services for advanced degree employment opportunities?</legend>

<input type="radio" name="tx_pbsurvey_pi1[7][0][0]" value="1"  /
>No<br />

<input type="radio" name="tx_pbsurvey_pi1[7][0][0]" value="2"  /
>Yes<br />
</fieldset>

...
<fieldset ...>
</fieldset>

</form>
</div>

Some questions are pretty long and cannot fit in the layout.  My
current style sheet has,

.survey div {margin-bottom: 10px;}
.survey_item {margin-top: 10px; margin-bottom: 10px;}
.question {font-size: 100%; font-weight: bold; }

What should I so long questions can be broken into multiple lines to
fit in the layout that has 450px width?

Thanks in advance for any help,

Bing
Jukka K. Korpela - 23 Feb 2007 08:07 GMT
Scripsit dubing@gmail.com:

> <legend class="question"><span class="questionNumber">6.</span>If the
> answer to question 11 is yes, do you think they provide adequate
> services for advanced degree employment opportunities?</legend>

From the styling point of view, <legend> is a nightmare. The common
rendering of <legend> in browsers cannot be described in CSS terms, and CSS
settings have varying effects on it.

One of the problems is that normal wrapping does not take place, and setting
white-space: normal doesn't change this. You can insert explicit line breaks
in the markup, using <br>, but that would be awkward.

From the markup point of view, the problem of excessively long <legend>
texts should not appear. According to the HTML 4.01 specification, "The
LEGEND element allows authors to assign a caption to a FIELDSET. The legend
improves accessibility when the FIELDSET is rendered non-visually." It has,
among other things, the following example:

<FIELDSET>
 <LEGEND>Current Medication</LEGEND>
 Are you currently taking any medication?
 <INPUT name="medication_now"
 ...
 </FIELDSET>

So the general idea is that the legend is a short caption, or like a
low-level heading. Without context, it is of course impossible to make a
specific suggestion on the formulation. But generally, a legend that needs
to wrap (in fairly normal browsing situations) is too long and needs
reformulation.

> Some questions are pretty long and cannot fit in the layout.

Just put the questions inside the <fieldset> after the <legend> element.

> .question {font-size: 100%; font-weight: bold; }

Bolding long texts is generally counter-productive, since bold text is more
difficult to read. The legend might be bolded, but the question should be
normal text so that it can be read conveniently.

> What should I so long questions can be broken into multiple lines to
> fit in the layout that has 450px width?

For all that you can know, 450px might not accommodate a _word_ without
wrapping. Stop imposing fixed widths, _especially_ on forms. A page with a
form is not supposed to be primarily an esthetic experience but a user
interface. Let form follow function. The user may need all the space
available.

Signature

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

dubing@gmail.com - 23 Feb 2007 14:18 GMT
> Scripsit dub...@gmail.com:
>
[quoted text clipped - 50 lines]
> --
> Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/

Thanks much for the lucid explanation!  Really appreciated it.  Looks
like <fieldset> and <legend> doesn't fit in out situation.  I changed
to <div>, all looks better now.

Bing
John Hosking - 23 Feb 2007 15:04 GMT
>>Scripsit dub...@gmail.com:

>>From the markup point of view, the problem of excessively long <legend>
>>texts should not appear. According to the HTML 4.01 specification, "The
[quoted text clipped - 22 lines]
> like <fieldset> and <legend> doesn't fit in out situation.  I changed
> to <div>, all looks better now.

Then it seems as if you didn't read all of Jukka's words. What's wrong with:

<fieldset class="survey_item">
<legend class="question"><span class="questionNumber">6.</span></legend>
If the answer to question 11 is yes, do you think they provide adequate
services for advanced degree employment opportunities?
<input type="radio" name="tx_pbsurvey_pi1[7][0][0]" value="1" />No<br />
?

Signature

John

dubing@gmail.com - 23 Feb 2007 18:50 GMT
On Feb 23, 9:04 am, John Hosking <J...@DELETE.Hosking.name.INVALID>
wrote:
> dub...@gmail.com wrote:
>
[quoted text clipped - 37 lines]
> --
> John

Aha!  Thanks much for waking me up.  I got the point now.  Yup, looks
like that helps fix my problem.

Bing
عرب زواج - 24 Feb 2007 01:50 GMT
بسم الله الرحمن الرحيم

افضل موقع للتعارف بين  الجنس ين الشباب والبنات من كل دول العالم
www.arabzwaj.com

بنات وشباب عايزيين يتعرفوا عليكم

صور عارية حقيقية

تعارف مجاني من كل دول العالم www.arabzwaj.com
 for marrige and friend shipافضل تعارف بين الشباب والبنات موقع زواج
مجاني www.arabzwaj.com

www.arabzwaj.com افضل موقع مجاني للتعارف و للزواج الشرعي

www.arabzwaj.com   بنات وشباب عايزه تتعرف عليكم

the best web site formarrige and frindship www.arabzwaj.comافضل موقع
مجاني للتعارف و للزواج
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.