Jump to content
php.lv forumi

IE un pozicionēšana


Maris-S

Recommended Posts

Kaut kas neiedomājams, ja kaut kas nestrādās ar css, tad tas pilnīgi noteikti būs ēzelī!

 

Problēma rodas ja absolūti pozicionētā div tiek ielikti relatīvi pozicionēti.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Positioning</title>
</head>

<body>
<div style="position: absolute; top: 50px; left: 100px">
	<div style="height: 20px; background: blue; color: white">
		Caption
	</div>
	<div style="width: 500px; height: 300px; background: lime">
		Content.
	</div>
</div>
</body>
</html>

 

Mozillā parāda tā kā tam vajadzētu būt, satura sadaļa pastiepj visu konteinera divu, līdz ar to virsraksta rindiņa pastiepjas, kā arī vajadzētu būt relatīvi pozicionētam div, viņam jāpastiepjas 100% platumā, bet IE viņš nepastiepjas. Varbūt kāds ir atrisinājis šādu problēmu. Pa google tā arī nesanāca atrast risinājumu.

Link to comment
Share on other sites

Tā, nu izskatās ka risinājumu atradu, kods sekojošs:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Positioning</title>
</head>

<body>
<div style="border: solid 1px; position: absolute; top: 50px; left: 100px">
	<div style="width: 100%; position: absolute; height: 17px; background: blue; color: white">
		Caption
	</div>
	<div style="width: 500px; height: 300px; padding-top: 17px; background: lime">
		Content. Content. Content. Content. Content. Content. Content. Content. Content. Content.
	</div>
</div>
</body>
</html>

Link to comment
Share on other sites

×
×
  • Create New...