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

How to align text in a floated DIV

Hi,

I have the following code snippet:

<div id="header_menuitems">
<a href="home" title="Home page">Home</a|
<a href="aboutus" title="About Us">About Us</a|
<a href="contactus" title="Contact Us">Contact Us</a|
<a href="home" title="Login">Login</a>
</div>
and accompanying CSS code:

#header_menuitems {
float: left;
padding-top: 5px;
padding-right: 10px;
color: white;
font-weight: bold;
text-align: right;
}

My problem is that the links are not aligning to the right of the DIV
(tested in Firefox and IE 7). However, if I comment out the:

float: left;

Then it aligns to the right of the DIV. Is this normal behavior and
if so, is there a work-around?

Thanks,
Don
Jun 27 '08 #1
1 1730
In article
<f9**********************************@34g2000hsh.g ooglegroups.com>,
donpro <do*********@rogers.comwrote:
Hi,

I have the following code snippet:

<div id="header_menuitems">
<a href="home" title="Home page">Home</a|
<a href="aboutus" title="About Us">About Us</a|
<a href="contactus" title="Contact Us">Contact Us</a|
<a href="home" title="Login">Login</a>
</div>
and accompanying CSS code:

#header_menuitems {
float: left;
padding-top: 5px;
padding-right: 10px;
color: white;
font-weight: bold;
text-align: right;
}

My problem is that the links are not aligning to the right of the DIV
(tested in Firefox and IE 7).
Yes it is aligning to the right but you cannot see it because a float
shrinks the width to fit the content. To see it, add a generous width
and a *black* border to the div.
However, if I comment out the:

float: left;

Then it aligns to the right of the DIV. Is this normal behavior and
if so, is there a work-around?
You have not quite described what you want worked around. You want the
menu to be on the left of the page generally but right within something
else. See above and supply a url for further information

--
dorayme
Jun 27 '08 #2

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

Similar topics

10
by: Markus Ernst | last post by:
Hi I have a strange problem with vertical-align. The case can be viewed at http://www.brainput.info/geschichte.html. HTML code: <div id="bild"><img src="geschichte.gif" width="274"...
6
by: TJ | last post by:
I've got a calendar that is based on the concept of lots of blocks that are spans with float:left. I would like to be able to have a detail section on the right side of the screen, so that when...
5
by: javaguy | last post by:
I have a data entry web application that is formatted heavily with tables. Having learned a bit of CSS, I'm hoping to rewrite this using <div> tags. But I have run into a formatting problem that...
2
by: Scott Bell | last post by:
http://www.scottbell.org/sunrise/ http://www.scottbell.org/sunrise/css/v2.css On the above URL I'm trying to get a sidebar menu on the right to align with the page text except it seems to sit...
2
by: Newry | last post by:
Hi, I'm trying to position something with CSS, to have the equivalent of: <table> <tr> <td><img src="foo.jgp"></td> <td valign=bottom>Label</td> </tr> </table>
6
by: Hymer | last post by:
Hello, I have a paragraph where I want to add one word at the end. I want this word to be aligned right but I want it to appear on the same line as the last line of the paragraph. So I don't...
1
by: jasonchan | last post by:
How do you align <ol> and <ul> elements when they are contained in a floated box? Here is my website: http://geocities.com/jasonchan483/ Here's my problem. The markers of the lists are...
3
by: torbs | last post by:
Strange behaviour in ie7. A collegue of mine put several images into a page using JCE in Joomla. JCE have the option to align these images and he left aligned every single one - to create a...
2
by: Jason Carlton | last post by:
Sorry if this goes through twice, I had an error the first time that I submitted. I have a bit of text that has a varying length, and I'm wanting to float text to the right. The problem is that...
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:
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.