css - Why does jQuery append() add a left margin/padding to "ajaxed" data? -


i have div contains tags (like tags feature on stackoverflow). use ajax append new tags outer div. works fine, except there additional left margin or padding of 5px added newly appended tags. when inspect html there no margin or padding listed, there. same thing happens in chrome, firefox, safari, , opera. here code:

html:

<div class="tags_wrap">     <div class="tag">         <div class="tag_wrap">tag 3</div>     </div>     <div class="tag">         <div class="tag_wrap">tag 2</div>     </div>     ... </div> 

css:

.tags_wrap {     margin:1px 7px 5px 0px;     float:left;     text-align:left !important; }  .tag {     padding:0;     margin:4px 7px 0 0;     border: 1px solid #094c7c;     -webkit-border-radius:5px;     -moz-border-radius:5px;     border-radius:5px;     background-color:#fff;     color:#000;     position:relative;     display:inline-block;     font-size:12px; }  .tag_wrap {     position:relative;     -webkit-border-radius:5px;     -moz-border-radius:5px;     border-radius:5px;     border-top: 1px solid #1c7abf;     border-right: 1px solid #1c7abf;     border-bottom: 1px solid #1c7abf;     border-left: 1px solid #1c7abf; } 

jquery:

$(document).ready(function(){     $('form#addsometags').unbind('submit').bind('submit',function() {         var newtag = $("form#addsometags > input[name=tagfield]").val();         $.ajax({             type: "post",             url: 'add_tag.php',             datatype: 'html',             data: {tag:newtag},             success: function(data){                 $('.tags_wrap').append(data);                 }             }         });         return false; }); }); 

the data returned .ajax() upon successful completion of php script other tags:

<div class="tag">     <div class="tag_wrap">tag 2</div> </div> 

there unwanted left margin or padding on newly "ajaxed" tags. if refresh page, margin no longer there. ideas on why happening?

most likely, whitespace, , html answer starts additional whitespace characters. when remove of them, should work (demo):

screenshot of working demo


Comments