473,796 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text-align left AND text-align-right in same container (on same line)

Is it possible to have a box (div) which sets a background-color and which
contains (on the same line) text which is left aligned and text which is
right aligned. (as in a table: two td's left one left aligned, right one
right aligned).

Thanxs!!
Sep 21 '06 #1
3 7878
gil


At approximately 2006/09/21 15:46, Sjef Janssen typed these characters:
>Is it possible to have a box (div) which sets a background-color and which
contains (on the same line) text which is left aligned and text which is
right aligned. (as in a table: two td's left one left aligned, right one
right aligned).

Thanxs!!

How about a div containing two divs. The inner divs could be aligned
separately
sample below has a different color border around each box but share the
same background color.

Gil

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Alignmen t test</title>
<style>
#container{back ground-color:pink;bord er:1px solid black; width:220px}
#left {margin:0;paddi ng:0;border:1px solid blue;width:100p x;
text-align:left; display:block; float:left;}
#right {margin:0;paddi ng:0;border:1px solid red;width:100px ;
text-align:right; display:block; float:right;}
</style>
</head>

<body>
<div id="container" >
<div id="left">This text should be aligned to the left</div>
<div id="right">But this text should be aligned to the right</div>
</div>
</body>
</html>
Sep 21 '06 #2
"Sjef Janssen" <ma************ *@planet.nlwrot e:
>Is it possible to have a box (div) which sets a background-color and which
contains (on the same line) text which is left aligned and text which is
right aligned. (as in a table: two td's left one left aligned, right one
right aligned).
Why, what are you trying to do?

--
Spartanicus
Sep 21 '06 #3
My first idea was to solve it with a table inside the box, But that's not
CSS is it? The container idea with the two div's inside solves it as well,
now with CSS! Thanks for thinking with me!!

Sjef

"Sjef Janssen" <ma************ *@planet.nlschr eef in bericht
news:45******** **************@ text.nova.plane t.nl...
Is it possible to have a box (div) which sets a background-color and which
contains (on the same line) text which is left aligned and text which is
right aligned. (as in a table: two td's left one left aligned, right one
right aligned).

Thanxs!!


Sep 22 '06 #4

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

Similar topics

14
2621
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file (that part's not here -- spotlighting the problem code): --------BEGIN CODE PAGE------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
10
11459
by: Steve | last post by:
I'm not sure if I should be using tables here to structure the layout or if CSS is okay. I have a data entry form in which I have floated the labels to one side, and given them a specific width. With regular input such as textboxes, everything lines up fine. The problem I'm having is that I have an unordered list of checkboxes, and only the first item will line up with the label. The additional checkboxes and their labels end up being...
19
2519
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with the declaration for the C library function (stdlib.h in this case) then define/declare my own function with the same name, am I safe? It seems to work on my compiler, but I wonder if this is portable or even acceptable? thx
2
1504
by: marcus.lecount | last post by:
Hi to anyone out there that is taking the time to read this. I'm new to ..net and any help given is appreciated. I am displaying a datalist on a page and I want to limit the length of the returned container.dataitem that is displayed to 39 characters. How do i do this in asp.net? I can do this in classic asp by using the len() function, but i'm a bit stuck on how to do it in asp.net. Thanks for any help you can give, my code is below.
1
1838
by: charlie | last post by:
I started out with table based page and moved to a managed absolute position and now I've been trying to do the project again. Here is a link to the absolute position page. http://63.134.232.79/untitled-1.htm I spent some time trying different layouts. The link below seems to be the best approach. http://63.134.232.79/untitled-13.html
2
1729
by: utab | last post by:
Hi, there Assume that I have three vectors x,y and z that has the same number of elements. Can I use a common iterator for these three. I did it with iterx, itery and iterz but the thing I wondered was: in a for loop you can write array elements by using the same index such as; for (int i = 0 ; i!=10; ++i ) cout << x << y << z << endl; Bu
3
2285
by: jrod11 | last post by:
Hi everyone, I'm working on creating a company intranet or my company and having trouble with IE. I have a navigation bar at the bottom of my page that is a quick links bar and is a fixed position. the background image is a .jpg. Depending on the computer, the background image will appear or not show up at all. The weird part is that the SAME version of IE 8 will show it on one computer, but another computer that has IE 8 will not. I...
3
5401
by: Darren Laverick | last post by:
Hi I am trying to make dropdown menus for my website and am puzzled as to why my float left, in my container div, is not working (it is going underneath). Here is the code for both files. i hope someone csn put me right and tell me what code to change CSS FILE @charset "utf-8"; #navMenu {
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
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,...
1
10187
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,...
1
7553
isladogs
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...
0
5446
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...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
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...

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.