4 replies [Last post]
gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 45 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

anyway i can align the absolutly positioned element (I.E the with the element) with the element ?

<!DOCTYPE html>
 
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form Load</title>
<link rel="stylesheet" type="text/css" href="stye.css">
 
<style type="text/css">
  body{margin: 0 ; padding: 0;}
  .m-item{position:relative;margin-top: 200px; background: pink; height: 4em; line-height: 4em ; width: 500; }
  .absol{
	position: absolute; top: 0;
	left: 0;   padding: 10px; background: #eee;
  }
  .just{
  	padding: 0 2em;
  }
 
</style>
</head>
<body>
 
<div class="m-item">	
	<span class="absol"></span><a class="just">Just Do it !!</a>
</div>
</body>
</html>                                	

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 15 hours 59 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9761
Points: 3843

It does align

The span element is perfectly aligned in the upper left corner of its parent. If you want the anchor text to show up there, it needs to be nested in the span, or lose the span and make the anchor AP.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 45 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Thank But AP ???

What is AP Gary ?? Cool

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 5 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Gary is showing his coolness

Gary is showing his coolness by using acronyms Smile
Absolutely Positioned

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 45 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

LOL Tony

Thnaks .