HTML/CSS I'm trying to center box in CSS and HTML

AI Thread Summary
To center a box with a span and a div inside both horizontally and vertically, using CSS and HTML, absolute positioning or table cells are recommended methods, especially for compatibility with Internet Explorer. Absolute positioning allows precise placement of elements, while using a table cell with the `align` and `valign` attributes can effectively center content. The discussion highlights that relying on `vertical-align` or `valign` for divs may not yield consistent results in IE, making these alternative methods more reliable for achieving the desired layout.
Sam_
Messages
15
Reaction score
0
Please help!

Does anyone here know much about CSS and HTML? I'm trying to center box (have it as a span with a div inside - a box in a box) both horizontally and vertically. I can get it to work just fine in Firefox, but IE won't let me do it. I've tried everything I can think of, I've looked for help online and tried what I found. Nothing. Does anyone know how to do it?
 
Technology news on Phys.org
If you're using vertical-align or valign then that's the problem since it doesn't work well for divs in IE.

You should either go with a table cell, or use absolute positioning. For example:
Code:
<html>
<body leftmargin="0px" topmargin="0px">
	Using absolute positioning
	<div style="width:300px;height:300px;border:solid 1px #000000;">
		<div style="left:100px;top:100px;width:100px;height:100px;border:solid 1px #000000;position:absolute;z-index:2">
		
		</div>
	</div>
	Using table cells
	<table cellspacing="0px">
		<tr>
			<td align="center" valign="middle" width="300px" height="300px" style="border:solid 1px #000000">
				<div style="width:100px;height:100px;border:solid 1px #000000;"></div>
			</td>
		</tr>
	</table>
</body>
</html>
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
9
Views
2K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
5
Views
2K
Replies
5
Views
2K
Replies
2
Views
1K
Replies
3
Views
2K
Replies
3
Views
2K
Back
Top