小编Gor*_*ard的帖子

HTML水平线之前的间距

我在HTML中设置了一些签名,最终将在Outlook中签名.我遇到的一个问题是,当插入一条水平线时,它会在线上方插入一个大空间,在线下方插入一个较小的空间.我的问题是水平线上方的空间非常大.这几乎是一个完整休息的大小

<br>
Run Code Online (Sandbox Code Playgroud)

如果我通过在水平线之前的文本之后设置间距来手动编辑Outlook中的签名就可以了,但我不能手动为我需要编辑的#他们执行此操作.这是我的问题的一个例子:

<html>
<head>
    <title>HTML Online Editor Sample</title>
</head>
<body>
    <p>
        <span style="font-size:12pt;"><span style="font-family: arial, helvetica, sans-serif;"><b>This is a test</b></span></span></p>
    <hr style="height: 2px; width: 99%; background-color: #848484" />
    <p>
        <span style="font-size:10pt;"><span style="font-family: arial, helvetica, sans-serif;"><b>Text under the line</b></span></span></p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

有没有办法可以在线之前或之后收紧文字?

html css horizontal-line

3
推荐指数
1
解决办法
1万
查看次数

Html代码给你在标题上放了一张图片

如何使用html将图片放在网站的标题中

    <html>  
    <head> 

    <title src="android.jpg"> Androids apps </title>

    </head> 
    </html>  
Run Code Online (Sandbox Code Playgroud)

这没用,有人知道怎么做

html favicon

0
推荐指数
1
解决办法
1万
查看次数

无法获取django模板标签返回unicode

我正在编写一个应用程序来跟踪2个玩家之间的一系列匹配.我正在使用Django的User模型并使用我自己的模型进行扩展UserProfile.

我将用户名存储User为steamID(例如:)76561197965801299,然后在登录时查找他们的用户名,并进行更新UserProfile.

而不是看着 76561197965801299,我想看一个用户名,在一个页面上,我想用更多好东西装饰这个用户名,所以我写了一个模板标签.

问题:

我似乎无法从我的模板标签打印unicode数据.

实际错误:

'ascii'编解码器无法对位置16中的字符u'\ u260e'进行编码:序数不在范围内(128)

通常Django不会打扰我的unicode问题(例如:我可以在管理页面中看到这个unicode对象没问题)但我从未尝试过应用模板标签,所以显然我在这里做错了.

模板/阶梯/ match_game_listing.html

{{ match.challengee|steam_name }}
Run Code Online (Sandbox Code Playgroud)

match.challengee这种情况下是76561197971597000.

梯/ templatetags/ladder_filters.py

from django import template
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import mark_safe
from cafe.models import UserProfile

register = template.Library()

@register.filter()
def steam_name(name):
    try:
        user_obj = User.objects.get(username=name)
        user_prof = UserProfile.objects.get(user_id=user_obj.id)

        url = user_prof.url
        handle = unicode(user_prof.handle)
        avatar = user_prof.avatar

        steam_string = "<a …
Run Code Online (Sandbox Code Playgroud)

python django unicode django-templates

0
推荐指数
1
解决办法
3192
查看次数