删除h1标签中的内部空间 [英] Remove inner space in h1 tag

查看:130
本文介绍了删除h1标签中的内部空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,在HTML和CSS的初学者!我试图得到一个标志和标题的正确对齐。两者应该在同一行。问题是,我不能删除h1的内部空间,并且在文本的顶部总是有一个边缘(如果我的颜色bg为h1,​​我看到它进一步延伸到文本上方)。有没有办法解决这个或我做错了?我想要两个完全相同的高度和完全相同的水平位置(标题中的T的顶部应该在img的顶部,底部相同)。

Hi im a beginner in HTML and CSS! Im trying to get the proper alignment of a logo and a title . Both of them should be on the same line. The problem is that i cant remove the inner space of the h1 and there is always a margin on top of the text (if i color the bg for the h1, i see that it extends further above the text). Is there a way to solve this or am i doing it wrong? I want both of them to be exactly the same height and in the exact same horizontal position (the top of the "T" in title should be at the top of the img and the same for bottom).

HTML:

<header>
    <img src="images/logo.gif" alt="logo">
    <h1>Title</h1>
</header>

CSS:

header
{
    overflow:auto;
}

header img
{
    float:left;
    width:55px;
    height:55px;
    margin-right:20px;
}

header h1
{
    float:left;
    padding:0px;
    margin:0px;
    font-size:55px;
}


推荐答案

- 高到固定值?

h1 { line-height: 55px;}

这篇关于删除h1标签中的内部空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆