473,395 Members | 1,504 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,395 software developers and data experts.

newline before element?

Can a <span> element be made to appear in new line without making it a block
element?

I have the following code:
<span class="one">one</span>
<span class="two">two</span>
<span class="three">three</span>
<span class="four">four</span>

and I want to achieve the following:

one two
three four
Thanks in advance,
suncho
Jul 20 '05 #1
7 17629
"Atanas Boev" <su*************@cs.tut.fi> writes:
Can a <span> element be made to appear in new line without making it a block
element?

I have the following code:
<span class="one">one</span>
<span class="two">two</span>
<span class="three">three</span>
<span class="four">four</span>

and I want to achieve the following:

one two
three four


Suncho, I don't think I understand the question. Why not:

<p>
<span class="one">one</span>
<span class="two">two</span>
<br />
<span class="three">three</span>
<span class="four">four</span>
</p>

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #2

"Haines Brown" <br****@teufel.hartford-hwp.com> wrote in message
news:87************@teufel.hartford-hwp.com...
"Atanas Boev" <su*************@cs.tut.fi> writes:
Can a <span> element be made to appear in new line without making it a block element?

I have the following code:
<span class="one">one</span>
<span class="two">two</span>
<span class="three">three</span>
<span class="four">four</span>

and I want to achieve the following:

one two
three four


Suncho, I don't think I understand the question.


I meant if it is possible only through CSS definitition of the classes "two"
or "three" somehow without the need of <br />. But you are right, if they
have <br /> probably thats the only way... or is it? I found something like
"display: run-in" but I got the impression it's only for headings.

suncho
Jul 20 '05 #3
Atanas Boev wrote:
Can a <span> element be made to appear in new line without making it a
block element?

I have the following code:
<span class="one">one</span>
<span class="two">two</span>
<span class="three">three</span>
<span class="four">four</span>

and I want to achieve the following:

one two
three four


If you want to avoid using a <br> element, then you could use generated
content:

span.three:before {
content: "\a";
}

That's not well supported across browsers, though.

--
Jim Dabell

Jul 20 '05 #4
"Atanas Boev" <su*************@cs.tut.fi> writes:
"Haines Brown" <br****@teufel.hartford-hwp.com> wrote in message
news:87************@teufel.hartford-hwp.com...
"Atanas Boev" <su*************@cs.tut.fi> writes:
Can a <span> element be made to appear in new line without making it a block element?

I have the following code:
<span class="one">one</span>
<span class="two">two</span>
<span class="three">three</span>
<span class="four">four</span>

and I want to achieve the following:

one two
three four


Suncho, I don't think I understand the question.


I meant if it is possible only through CSS definitition of the classes "two"
or "three" somehow without the need of <br />. But you are right, if they
have <br /> probably thats the only way... or is it? I found something like
"display: run-in" but I got the impression it's only for headings.


Oh, I see. Well, this is probably illicit, but it works on my
browser, anyway:

.three, .four {
position: relative;
top: 0.5em;
float: left;
}

<span class="one">one</span>
<span class="two">two</span>
<span class="three">three </span>
<span class="four">four</span>

On my brouser I get:

one two

three four

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #5

"Haines Brown" <br****@teufel.hartford-hwp.com> wrote in message
news:87************@teufel.hartford-hwp.com...
Oh, I see. Well, this is probably illicit, but it works on my
browser, anyway:

.three, .four {
position: relative;
top: 0.5em;
float: left;
}

<span class="one">one</span>
<span class="two">two</span>
<span class="three">three </span>
<span class="four">four</span>
I love it. As you're putting spaces between the spans and a
non-breaking space within a span, it will reduce to one space
like normal?
On my brouser I get:

one two

three four


I just like how you spell browser. At first, I read "On my
trouser I get" and it amused me!
Jul 20 '05 #6
"Neal" <ne**@spamrcn.com> writes:
"Haines Brown" <br****@teufel.hartford-hwp.com> wrote in message
news:87************@teufel.hartford-hwp.com...
Oh, I see. Well, this is probably illicit, but it works on my
browser, anyway:

.three, .four {
position: relative;
top: 0.5em;
float: left;
}

<span class="one">one</span>
<span class="two">two</span>
<span class="three">three </span>
<span class="four">four</span>


I love it. As you're putting spaces between the spans and a
non-breaking space within a span, it will reduce to one space
like normal?


a) Re. spaces between spans (two and three/four I assume you mean)
that is done with relative positioning. Isn't that legit for in-line
elements? The space-reduction routine should have no effect here.

b) Re. the non-breaking space within a spam (using &##160;). That
is certainly improper, but works in a practical sense and avoids the
collapsed space to which you refer. If I want to behave myself, I'd
get rid of the " " and add instead a "padding-right: 5px;"
attribute to the style definition of .three and .four.

If I understand your rhetorical question correctly, there is no
"reduction to one space" on my browser (galeon), and I don't see why
there should be. How's it look on your "brouser"? The   is not a
space, but an empty character.

One problem with my scheme is that it gets mixed in with other
elements that may happen be on the page, and I don't know how to
prevent that withough resorting to blocks (div). Also, I believe the
two lines should be placed in a container, such as <p>. Am I right? If
so, that would violate one of the parameters of the challenge.

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #7

"Haines Brown" <br****@teufel.hartford-hwp.com> wrote in message
news:87************@teufel.hartford-hwp.com...
If I understand your rhetorical question correctly,


It wasn't rhetorical. It was serious. I've never tried it,
perhaps I should do the experiment.

The "brouser" thing just made me laugh. No offense intended.
Jul 20 '05 #8

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

Similar topics

2
by: Farhad | last post by:
Hi, in the following example there is a output difference in version 5.00 and 5.8 of Perl. In case of a missmatch in element 2, the whole element gets lost instead of an "undef" value. Does...
18
by: Tjerk Wolterink | last post by:
i have the following rule, <xsl:template match="br"> <br/> </xsl:template> This should convert all <br/> to <br/> but, my transformer transforms it all to
7
by: jjouett | last post by:
I'm trying to preserve the newline characters in my transformed XML (read from a file) to provide a meaningful line number when validation errors occur. However, my current method which performs an...
2
by: DesperateDan | last post by:
As the title say, I can't aquire element's value if it hosts sub-elements. Let me explain - My XML looks like this:- <a> <infill>xxxxxx</infill> <SourceEndPoint>testdata <EndPoint> <AliasRef...
4
by: Peter Kirk | last post by:
Hi I would like to ask a little bit about the value Environment.Newline: what is it and what is the point of it? Ok, I can see in the docs that it represents "newline" for the current platform -...
5
by: Ward Germonpré | last post by:
Hi, From a PHP backend I generate a javascript array like this : bevestigingen = [{id:'47',leverancier:'VELUX',depot:'KNO',klant:'',werf:'',referentie:'Ro els',producten:'DKL U04 1100 1st...
17
by: pbd22 | last post by:
hi. i keep getting this error. as i understand it, my xml isn't formatted correctly. the online errata suggests the standard formatting to solve this problem: element (tab) (tab) element
12
by: sklett | last post by:
**Disclaimer** The element I need to create might not be valid XML, but it's not my fault, I'm following a required format for an integration project. I've got 99% of the XML created nicely...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.