Hi.
I'm trying to place three "<div class=foo>" boxes in the same line:
----html--------------------
<HTML><HEAD>
<link href="test.css" rel="stylesheet " type="text/css" />
</HEAD>
<body>
<div>
<div class="foo">1</div>
<div class="foo">2</div>
<div class="foo">3</div>
</div>
</body>
</HTML>
-------------------------
-------test.css----------
..foo
{
font-family: sans-serif;
font-size: 290%;
background-color: red;
margin: 5px;
width: 100px;
}
-----------------------
However, these three boxes are placed each in one line. What am I
doing wrong?
Thank you very much. 4 13736
On 2007-03-11, Francesco Moi <fr**********@u sa.comwrote:
Hi.
I'm trying to place three "<div class=foo>" boxes in the same line:
----html-------------------- <HTML><HEAD> <link href="test.css" rel="stylesheet " type="text/css" /> </HEAD> <body> <div> <div class="foo">1</div> <div class="foo">2</div> <div class="foo">3</div> </div> </body> </HTML>
-------------------------
-------test.css----------
.foo
{
font-family: sans-serif;
font-size: 290%;
background-color: red;
margin: 5px;
width: 100px;
}
-----------------------
However, these three boxes are placed each in one line. What am I
doing wrong?
It's because div is display: block by default, and blocks start new
"lines", or at least, go beneath one another.
Add display: inline-block to .foo, or if you need it to work in FF or
IE, add float: left instead.
For completeness, display: inline is no good because you want to set the
widths on these boxes.
Scripsit Ben C:
>However, these three boxes are placed each in one line. What am I doing wrong?
It's because div is display: block by default, and blocks start new
"lines", or at least, go beneath one another.
Add display: inline-block to .foo, or if you need it to work in FF or
IE, add float: left instead.
Alternatively, set position: relative for the outer div and use "absolute"
positioning for the inner divs. "Absolute" positioning then means
positioning relative to the outer div.
In a simple case, float: left is probably simplest. Remember to use clear:
both for the element after the divs to stop floating.
--
Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/
On Mar 11, 9:31 am, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
However, these three boxes are placed each in one line. What am I
doing wrong?
Add display: inline-block to .foo, or if you need it to work in FF or
IE, add float: left instead.
Alternatively, set position: relative for the outer div and use "absolute"
positioning for the inner divs. "Absolute" positioning then means
positioning relative to the outer div.
Alternatively, use nobr tag.
On 2007-03-11, sc************* @gmail.com <sc************ *@gmail.comwrot e:
On Mar 11, 9:31 am, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
>However, these three boxes are placed each in one line. What am I doing wrong?
Add display: inline-block to .foo, or if you need it to work in FF or
IE, add float: left instead.
Alternativel y, set position: relative for the outer div and use "absolute" positioning for the inner divs. "Absolute" positioning then means positioning relative to the outer div.
Alternatively, use nobr tag.
The drawback with using position: absolute is that you will have to set
the "left" property on each block to position it on the line. With float
or inline-block, the browser works out those positions for you.
The problem with using the nobr tag is that, apart from being
nonstandard (the white-space property is preferred) it only affects how
inline boxes are broken to fit across lines. Since the OP wants to set
width on these boxes, they cannot be inline, and will therefore be
unaffected by nobr. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN'
COOL!!! ***MAN*** that would save me a buttload of work and make my life
sooooo much easier!"
As opposed to minor differences of this feature here, that feature there.
Variations on style are of no interest to me. I'm coming at this from a...
|
by: Dan R Brown |
last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to
break up this form into several "tabbed" sections, I break up the form using <div>
tags. Each <div style="display:none"> can be displayed by setting the style attribute
to "display:", or hidden with "display:none". This gives the illusion that the person
filling out the form is switching from page to page...without the overhead of extra
hits on the server,...
|
by: Matt Adams |
last post by:
I want define for a couple of words inside a longer text with different font specifications.
I declared it like:
....text before....
<FONT class=aaa> these text should get other attributes </FONT>
text after
However when I let this html source validate the FONT tag is marked as not compatible with XHTML.
So how do I specify otherwise new font attributes to only a few words?
|
by: Tuckers |
last post by:
My question is, if I have created my own library which lives in its own
install directory, to refer to its header file is it better to use
#include "MyLibrary.h"
or
#include <MyLibrary.h>
Assume that this library will be used by other groups. I think the answer
|
by: Mason A. Clark |
last post by:
LAST WORD(s):
1. MSIE6 and Firefox will go to the top of the page on
command <a href="#top">go upsy</a> even if
there is NO name="top" or id="top"
They know what a "top" is :-)
Opera does not.
| |
by: scottyman |
last post by:
I can't make this script work properly. I've gone as far as I can with
it and the rest is out of my ability. I can do some html editing but
I'm lost in the Java world. The script at the bottom of the html page
controls the form fields that are required. It doesn't function like
it's supposed to and I can leave all the fields blank and it still
submits the form. Also I can't get it to transfer the file in the
upload section. The file name...
|
by: liaoo |
last post by:
Dear all,
I have a question about using cout<<...
In standard C, I can use printf("%x",...) to print "hex" number. But in
Watcom C++, when using cout<<, I got the "decimal" representation !
Ex. a = 0x80000004
if ( using printf("%x",a) ) then I got "80000004" on screen
|
by: Jan Wagner |
last post by:
Hi,
can't figure this one out, what's the CSS way to specify the language?
In HTML it would be simply an lang="xx" attribute, or XHTML
xml:lang="xx", but, how about in CSS? This would be required for a
screen reader (text to speech) for accessibility, to help the reader
software use the correct presentation method (e.g. correct language
module).
|
by: Anastasios Hatzis |
last post by:
I'm looking for a pattern where different client implementations can use the
same commands of some fictive tool ("foo") by accessing some kind of API.
Actually I have the need for such pattern for my own tool
(http://openswarm.sourceforge.net). I already started restructuring my code
to separate the actual command implementations from the command-line scripts
(which is optparser-based now) and have some ideas how to proceed. But
probably...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |