简体   繁体   English

使用AJAX加载页面时,为什么我的URL之间没有空格?

[英]Why is there no space between my URLs when page is loaded with AJAX?

I have the following code for four a elements with Bootstrap's btn class on them. 我对带有Bootstrap的btn类的四个a元素具有以下代码。

<a href="{% url 'qna:answer-create-view' object.pk %}" class="btn btn-primary btn-xs">Answer</a>
<a href="#" class="btn btn-default btn-xs"><i class="fa fa-thumbs-o-up"></i> | 0</a>
<a href="#" class="btn btn-default btn-xs"><i class="fa fa-thumbs-o-down"></i> | 0</a>
<a href="#" class="btn btn-default btn-xs">Follow</a>

Normally there was a little space between them when I loaded them as an HTML page. 通常,当我将它们作为HTML页面加载时,它们之间有一些空间。 However, I implemented load() function in my JS file and is now loading part of the page containing those elements so that it takes less time to load a new page. 但是,我在JS文件中实现了load()函数,现在正在加载包含这些元素的页面的一部分,以便花费更少的时间加载新页面。 But in this method there are no spaces between those elements and it looks aesthetically unpleasant. 但是在这种方法中,这些元素之间没有空格,并且在美学上看起来不愉快。 How can I fix that? 我该如何解决?

Just add margin to them using CSS 只需使用CSS为他们增加利润

.btn{
   margin: 0 5px;
   display: inline-block;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 jQuery 在页面加载时不工作? - Why my jQuery not working when page loaded? 为什么我的jquery函数在Ajax加载的页面中的div上不起作用 - Why does my jquery function not work on div in page loaded by ajax 为什么加载页面时“showData()”不打印我的 arrays 值? - Why is "showData()" not printing my arrays value when page is loaded? 在页面加载之前,我需要处理页面上的网址 - I need to process the urls on my pages before the page is loaded 加载AJAX页面时,jQTouch执行代码 - jQTouch execute code when AJAX page is loaded 通过AJAX加载页面时jQuery无法正常工作 - jQuery not working when page loaded via AJAX 单击按钮时刷新Ajax加载的页面 - Ajax loaded page refreshing when clicking on button 无法处理我页面上的 ajax 调用,因为 Django request.is_ajax 在页面初始加载时返回 True - Can't process ajax call on my page because Django request.is_ajax returns True when page is intially loaded CasperJS:为什么我的网址加载时会更改为:空白? - CasperJS : Why does my url change to about:blank when my page is loaded? 为什么提交@HtmlRenderPartial加载的表单时,我的Ajax调用仅触发一次 - Why does my ajax call fire only once when submitting forms loaded with @HtmlRenderPartial
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM