ShareThis

Wednesday, June 13, 2012

span align right is not working right

Problem: span align right does not align right

Fix: try using style="float:right;" on your html element that should align right.

Example Code:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var fade = false;


$(document).ready(function(){
  $("div").click(function(){
    if(!fade)
{
    $("div").fadeTo("slow",0.25);
     fade = true;
}
else
{
   $("div").fadeTo("slow",1);
fade = false;
}
  });
});
$(document).ready(function(){
  $("#close").click(function(){
    $("div").fadeOut(1000);
});
});
</script>
</head>
<body>
<div style="background:yellow;width:300px;height:300px">
<button>Click to Fade</button>
<span align="right">
<button style="float:right;" id="close">X</button></span>
</div>
</body>
</html>
Test it out on http://jsbin.com/#source -- Make sure you include jquery to see the fade stuff !

0 comments:

Post a Comment