Plater 7,872
Recognized Expert Expert
To accomplish what I am looking for (the image centered in it's parent top 'centered') I have done this: -
<div id="backing">
-
<div id="lbImgBacker">
-
<center>
-
<img id="Image1" src="banner.JPG" alt="" style="border-width:0px;" />
-
</center>
-
</div>
-
<div id="ExampleLeftAlignElement" ></div>
-
<!-- other elements and the rest of the page -->
-
</div>
-
The following CSS is also applied -
#backing
-
{
-
z-index: 100;
-
position: static;
-
display: block;
-
width: 760px;
-
background-color: #faebd8;
-
text-align:left;
-
}
-
#Image1
-
{
-
z-index: 100;
-
display: block;
-
height: 127px;
-
width: 756px;
-
border-width: 0px;
-
cursor: pointer ;
-
}
-
-
#lbImgBacker
-
{
-
z-index: 100;
-
position: static;
-
display: inline;
-
text-align: center;
-
width: 760px;
-
height: 130px;
-
color: #804000;
-
background-color: Transparent;
-
font-weight: bold;
-
font-size: 12pt;
-
}
-
The "text-align:left" in #backing is required for the rest of the page, and seems to override any child styles I attemp to apply.
For arguments sake, "lbImgBacke r" is the same width as "backing" and doesn't matter if the text-align is left/center/right. But the image INSIDE "lbImgBacke r" should be centered inside of it. This is what I cannot seem to do with style properties. That <center> tag is the only thing that does it, but is not allowed by W3 to be there.
Do I have an alternataive?
5 4680
Delete the opening and closing center tags. Add this to the CSS: -
#backing
-
{ margin: 0 auto;}
-
#Image1
-
{ margin: 0 auto;}
-
Plater 7,872
Recognized Expert Expert
Well I don't understand it, but that seemed to do the trick. Thanks!
Well I don't understand it, but that seemed to do the trick. Thanks!
I share your opinion. Or, do I? w3c Atli 5,058
Recognized Expert Expert
Well I don't understand it, but that seemed to do the trick. Thanks!
If you set the margin to auto, the browser will (should) try to automatically calculate the margin on all sides of the element, effectively placing it at the center.
This usually depends on both the inner and outer elements to have a fixed width so the margin can be calculated. This doesn't appear to work with vertical alignment tho, which is kind of weird considering that it's basically the same calculations.
This doesn't appear to work with vertical alignment tho, which is kind of weird considering that it's basically the same calculations.
Affirmative, Major Tom. Take your protein pill. Put your helmet on.
Ground Control,
Huston
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: The Plankmeister |
last post by:
Hi...
What's an equivalent of doing:
<center>hello!</center>
in 4.01 strict? I'm using stylesheets and am telling the various selectors I
want to be centred to "text-align : center;" but they only align textual
objects, not image objects:
|
by: Mark Moore |
last post by:
It looks like there's a pretty serious CSS bug in IE6
(v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and
renders as I would expect in Opera, FrontPage, and Netscape.
For some reason, there's an annoying vertical gap between adjacent
rules that doesn't go away. This looks like IE6 is incorrectly
setting the margin to some arbitrary value.
Does anyone know if this is a known bug at MS? If you know of one,
post the...
|
by: Dan |
last post by:
Hi,
I would just like to know if the istream operator takes only one
parammeter(object) at a time (like z) ?
istream operator>>(istream& in, Shape &z)
Cause I keep getting error concerning the amount my operator has for bother
cin , cout operator<< and >>
thanks
Dan
|
by: Julia Briggs |
last post by:
How do I construct a <iframe> or equivalent for FireFox/NS browsers,
inside a screen centered <div> tag? Can it be done?
|
by: Nathan Sokalski |
last post by:
As most of us probably know, the <centertag is deprecated. Because many
elements and controls have an align attribute, centering them is easy
enough. However, certain elements/controls do not (such as the ASP.NET
Button and Label controls). For the ASP.NET label control I usually just add
the following attributes:
Width="100%" style="text-align:center;"
However, this does not work for controls such as the ASP.NET Button control.
The...
| |
by: Steve Richter |
last post by:
I am using <div align=centerto center a horizontal menu on the page.
Problem is the center align of the div is rippling down to the menu
items and causing the text of the dynamic popup sub menu items to be
centered also. How can I center my navigation menu without centering
the menu item text?
thanks,
-Steve
|
by: jobs |
last post by:
I have a simple login page with roughly a 300px x 300px image behind
the asp.net login control. I need the login control to land in the
middle of the image. I want both the image and the login controlrol to
always be in the center of the page. How can I do this?
I use position:absolute to get the asp.net login control on top of
the image, but then when the IE window size is changed (by the user)
the login control does not center. Here's...
|
by: DiamondEagle |
last post by:
Is there a way to center the following div without using the <center>
tags?
<body bgcolor="#FFFFFF">
<center>
<div id="Test" style="background-color:#000000; color:#ffffff; width:
80%; text-align:center; line-height:100px;">Hello</div>
</center>
</body>
|
by: Stevo |
last post by:
I've found that for IE6+, if you add the property text-align:center to a
DIV, then *anything* inside it gets centered. That can be a table, an
object/embed, another DIV, an image, or some text.
Firefox and Safari on the other hand don't treat text-align in that way.
In my tests on those browsers, they only centers images and text. Any
DIVs, object/embeds or tables remain default unaligned and generally
appear on the left.
Considering...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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: 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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |