473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CSS: basic indentation question

Hello,

I would like to achieve the following
effect for an FAQ page without having
to resort to html tables. What is the
best way to do it using CSS (note how
the indentation is table-like)?

Best Regards... :-)

The J'uring Test FAQ
====================

Q: Is my name Joe Doe or is my
name John Doe?

A: How would I know? I tried searching
with Google and found several matches
but still cannot tell. So hey, you
could be Joe, John, someone else,
or you may not even be human.
Jul 23 '05 #1
10 3235
nz******@cs.mun.ca (Neil Zanella) wrote:
I would like to achieve the following
effect for an FAQ page without having
to resort to html tables. What is the
best way to do it using CSS (note how
the indentation is table-like)?
If you are asking about CSS, the right group is c.i.w.a.stylesheets.
Followups set accordingly.
The J'uring Test FAQ
====================

Q: Is my name Joe Doe or is my
name John Doe?

A: How would I know? I tried searching
with Google and found several matches
but still cannot tell. So hey, you
could be Joe, John, someone else,
or you may not even be human.


I assume that this is to be understood so that the text lines proper
(excluding "Q:" and "A:") start at the same position. This is _not_
completely evident from your description, since it becomes apparent (?)
only when your message is viewed using a monospace font.

This sounds tricky, and I'm afraid you'll at least need extra markup to
make "Q:" and "A:" elements that can be styled, in addition to the
obvious (?) markup

<h2> Q: Is my name Joe Doe or is my
name John Doe?</h2>
<p>
A: How would I know? I tried searching
with Google and found several matches
but still cannot tell. So hey, you
could be Joe, John, someone else,
or you may not even be human.
</p>

Using <span>Q:</span> and <span>A:</span>, one approach might be

span { position: absolute;
left: -1.5em; }
h2, p { position: relative;
margin-left: 1.5em; }
h2 { font-size: 100%; }

(though you probably want to use classes for <span> and maybe <p>, or for
some containers of them, since you might have other <span> and <p>
elements on the page as well).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #2
"Neil Zanella" <nz******@cs.mun.ca> wrote in
comp.infosystems.www.authoring.html:
Q: Is my name Joe Doe or is my
name John Doe?


It could be done in several ways. Here's one.

In CSS:
p.qa {margin-left:2em; text-indent:-2em}
span.qa {width:2em}
In HTML:
<p class="qa"><span class="qa">Q:</span> Is my name ...</p>

(untested)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #3
On 28 Aug 2004 12:49:42 -0700, nz******@cs.mun.ca (Neil Zanella) wrote:

[crossed to ciwas and f-up set accordingly]
I would like to achieve the following
effect for an FAQ page... The J'uring Test FAQ
==================== Q: Is my name Joe Doe or is my
name John Doe?

A: How would I know? I tried searching
with Google and found several matches
but still cannot tell...


This is a CSS issue really and you might want to have a look at the
'ciwas' a-FAQ for some inspiration.

http://www.css.nu/faq/ciwas-aFAQ.html

which has its style sheet here...

http://www.css.nu/includes/ciwas-FAQs.css

I wrote the style sheet for the 'ciwas' FAQ's several years ago and to
the best of my memory the FAQ lists comes out pretty much as you want
all the way from modern browsers and down into IE4x/NS4x browsers.

--
Rex
Jul 23 '05 #4
Thank you for your reply. I now wonder, when should I
be using <span> and when should I be using <div>. What
is the difference?

Thanks,

Neil

Stan Brown <th************@fastmail.fm> wrote in message news:<MP************************@news.odyssey.net> ...
"Neil Zanella" <nz******@cs.mun.ca> wrote in
comp.infosystems.www.authoring.html:
Q: Is my name Joe Doe or is my
name John Doe?


It could be done in several ways. Here's one.

In CSS:
p.qa {margin-left:2em; text-indent:-2em}
span.qa {width:2em}
In HTML:
<p class="qa"><span class="qa">Q:</span> Is my name ...</p>

(untested)

Jul 23 '05 #5
On Sat, 28 Aug 2004 17:48:51 -0400, Stan Brown
<th************@fastmail.fm> wrote:
"Neil Zanella" <nz******@cs.mun.ca> wrote in
comp.infosystems.www.authoring.html:
Q: Is my name Joe Doe or is my
name John Doe?
It could be done in several ways. Here's one.

In CSS:
p.qa {margin-left:2em; text-indent:-2em}
span.qa {width:2em}

Don't think so.

"10.2 Content width: the 'width' property
This property does not apply to non-replaced inline-level elements. The
width of a non-replaced inline element's boxes is that of the rendered
content within them ... "

In HTML:
<p class="qa"><span class="qa">Q:</span> Is my name ...</p>

(untested)


I don't think there would be much wrong with using a table here, as the
Q and A logically belong with the associated text. But if anyone has a
good CSS solution I'd also be interested - for each of the possibilities
I've thought of so far, I've also found a reason for disliking them.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 23 '05 #6


Neil Zanella wrote:

Thank you for your reply. I now wonder, when should I
be using <span> and when should I be using <div>. What
is the difference?


The difference is between the text level and the block level. Please see
e.g. <URL:http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.3>.

Thor

--
http://www.anta.net/
Jul 23 '05 #7
"Neil Zanella" <nz******@cs.mun.ca> wrote in
comp.infosystems.www.authoring.html:
Thank you for your reply. I now wonder, when should I
be using <span> and when should I be using <div>.


[Please don't quote upside down, and please do trim quotes; see
<http://web.presby.edu/~nnqadmin/nnq/nquote.html>.]

<span> is for inline elements, and <div> is for block elements like
paragraphs and tables.

You can change that with CSS, but that's the intent.
Jul 23 '05 #8
"Stephen Poley" <sb******************@xs4all.nl> wrote in
comp.infosystems.www.authoring.html:Quoting my:
span.qa {width:2em}


Don't think so.

"10.2 Content width: the 'width' property
This property does not apply to non-replaced inline-level elements. The
width of a non-replaced inline element's boxes is that of the rendered
content within them ... "


Durn it, I forgot about that.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #9
On Sun, 29 Aug 2004 12:16:10 -0400, Stan Brown
<th************@fastmail.fm> wrote:
<span> is for inline elements, and <div> is for block elements like
paragraphs and tables.

You can change that with CSS, but that's the intent.


Yet it should be stressed that changing <span> to display: block; will not
make it legal to nest other block elements within it. The HTML must be
correct without the CSS, of course.
Jul 23 '05 #10
"Neal" <ne*****@yahoo.com> wrote in
comp.infosystems.www.authoring.html:
Yet it should be stressed that changing <span> to display: block; will not
make it legal to nest other block elements within it. The HTML must be
correct without the CSS, of course.


Agreed.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zhidian Du | last post by:
Hello, I have a program, whose output are XML files (at least 100 K) but there is no the CSS file to control its display. Is there any programs that can generate a CSS form these XML files? ...
29
by: Joseph Haig | last post by:
I am trying to use descriptive lists, <DL>, as shown in <http://www.maths.man.ac.uk/~jhaig/tmp/test.html> with a style sheet at <http://www.maths.man.ac.uk/~jhaig/tmp/default-2.css>. With Mozilla...
98
by: Pamel | last post by:
I know this must have been asked elsewhere, but I cannot find it. There is a piece of text on my web page that I don't want browsers to resize. IE won't resize it if I specify the size in px, but...
2
by: darius | last post by:
Hi I want to do paragraphs with nested indent, like so para 1 .... ......... para 2 ....... ..... para 3 ...... .........
14
by: Xah Lee | last post by:
is there somewhere i can find the default css for browsers? e.g. what's the usual rendering in terms of css for <p>, <ul> etc. in particular, right now i'm interested in creating a style...
13
by: amykimber | last post by:
Hi all, I know I'm doign something really daft, but I can't get this to work... I have a form with a bunch of inputs called ship_owner - why the ? Because I'm submitting this page though php...
59
by: phil-news-nospam | last post by:
In followups by Brian O'Connor (ironcorona) to other posts, he repeats the idea that using tables in CSS is not something that should be done because IE doesn't support it. Of course I'm not happy...
13
by: deko | last post by:
I. A. B. II. A. 1) 2) B. C.
13
by: Dan Aldean | last post by:
Hi, I use ASP.NET 2.0 and I created a stylesheet, but I don't know how to make it visible to a web form "MyWebPage.aspx" that uses the master page. I put a reference to the css in the .master...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.