Html 第二行不是从最左边的位置开始的?

Html 第二行不是从最左边的位置开始的?,html,css,frontend,Html,Css,Frontend,我想在这里建一个画廊。但当我试图在第二行中添加一个img时,它从中间开始,而不是从最左边的位置开始。我试过“清除:左”,但不起作用。有人能帮忙吗?谢谢 小提琴链接:您可以尝试以下方法: 删除float:left并使用display:inline块 您可以尝试以下方法: 删除float:left并使用display:inline块 我刚刚删除了行,它就开始工作了。可能是这种字体设置有一些样式 真奇怪 我刚刚删除了行,它开始工作了。可能是这种字体设置有一些样式 真奇怪 这里的代码太多了!!你能用

我想在这里建一个画廊。但当我试图在第二行中添加一个img时,它从中间开始,而不是从最左边的位置开始。我试过“清除:左”,但不起作用。有人能帮忙吗?谢谢

小提琴链接:

您可以尝试以下方法:

删除float:left并使用display:inline块

您可以尝试以下方法:

删除float:left并使用display:inline块


我刚刚删除了行
,它就开始工作了。可能是这种字体设置有一些样式

真奇怪


我刚刚删除了行
,它开始工作了。可能是这种字体设置有一些样式

真奇怪


这里的代码太多了!!你能用小提琴来展示你的演示吗?>你能用你的小提琴吗?对我来说很好?你能更具体地谈谈这个问题吗?你用的是什么浏览器?@SamDenton我用的是Chrome.oo我看到问题了,两个图像向右浮动。我推荐@PradeepPansari的答案,因为它也解决了meI的问题。我也遇到了同样的问题,输入元素和文本的wierd边距显示为Gloria Hallelujah字体。这里的代码太多了!!你能用小提琴来展示你的演示吗?>你能用你的小提琴吗?对我来说很好?你能更具体地谈谈这个问题吗?你用的是什么浏览器?@SamDenton我用的是Chrome.oo我看到问题了,两个图像向右浮动。我推荐@PradeepPansari的答案,因为它也解决了meI的问题。我也遇到了同样的问题,输入元素和文本的wierd边距显示为Gloria Hallelujah字体。
<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="utf-8">
        <title>Jack Yuan | Web Developer</title>
        <link rel="stylesheet" href="CSS/normalize.css">
        <link href='http://fonts.googleapis.com/css?family=Gloria+Hallelujah' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Lobster&subset=latin,cyrillic-ext' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="CSS/main.css">
        <link rel="stylesheet" href="CSS/responsive.css">

    </head>
    <body>

        <header>

            <a href="index.html" id="logo">
                <h1>Jack Yuan</h1>
                <h2>Web Developer</h2>
            </a>

            <nav>

                <ul>
                    <li><a href="about.html">About</a></li>
                    <li><a href="index.html">Portfolio</a></li>
                    <li><a href="item.html" class="selected"> Items For Sale </a> <li>
                    <li><a href="contact.html">Contact</a></li>
                </ul>

            </nav>
        </header>
        <div id="sec">
        <section>
            <ul id="item_gallery">
                    <li>
                    <a href="itemImg/001.JPG">
                    <img src="itemImg/001.JPG" width="100" height="100" alt="">
                    <p> Hard Choices </p>
                    </a></li>

                    <li>
                    <a href="itemImg/002.JPG">
                    <img src="itemImg/002.JPG"width="100" height="100"  alt="">
                    <p> Linear Algebra </p>
                    </a></li>

                    <li>
                    <a href="itemImg/003.JPG">
                    <img src="itemImg/003.JPG"width="100" height="100" alt="">
                    <p> Physics 111 + 112 </p>
                    </a></li>

                    <li>
                    <a href="itemImg/004.JPG">
                    <img src="itemImg/004.JPG"width="100" height="100" alt="">
                    <p> For BUS 111</p>
                    </a></li>

                    <li>        
                    <a href="itemImg/005.JPG">
                    <img src="itemImg/005.JPG" width="100" height="100" alt="">
                    <p> Chemistry for G11 </p>
                    </a></li>

                    <li>
                    <a href="itemImg/006.JPG">
                    <img src="itemImg/006.JPG"width="100" height="100"  alt="">
                    <p> Chinese-English Dictionary </p>
                    </a></li>

                    <li>
                    <a href="itemImg/007.JPG">
                    <img src="itemImg/007.JPG"width="100" height="100" alt="">
                    <p> English-Chinese Dictionary </p>
                    </a></li>

                    <li>
                    <a href="itemImg/008.JPG">
                    <img src="itemImg/008.JPG"width="100" height="100" alt="">
                    <p> Amath 250</p>
                    </a></li>

                    <li>
                    <a href="itemImg/009.JPG">
                    <img src="itemImg/009.JPG"width="100" height="100"  alt="">
                    <p> STAT 230 </p>
                    </a></li>

                    <li id="ten">
                    <a href="itemImg/010.JPG">
                    <img src="itemImg/010.JPG"width="100" height="100" alt="">
                    <p> CS116 </p>
                    </a></li>

                    <li id="eleven">
                    <a href="itemImg/011.JPG">
                    <img src="itemImg/011.JPG"width="100" height="100" alt="">
                    <p> For CS245</p>
                    </a></li>
                </ul>
        </section>
        </div>

        <footer>
            <div id="mus">
            <embed src="夜空中最亮的星 Calculasian.mp3" loop="true" autostart="true" height="55mm">
            <p> 夜空中最亮的星 </p> 
            <p>Presented by Calculasian </p>
            </div>
            <div id="logo">
            <a href="https://www.facebook.com/jackyuan.jack">
            <img src="img/facebook.gif" alt="FaceBook Logo" class="icon">
            </a>
            <a href="https://twitter.com/Jack19909100">
            <img src="img/twitter.png" alt="Twitter Logo" class="icon">
            </a>
            </div>
            <p>Jack Yuan</p>
            <p>All Rights Reserved.</p>
        </footer>

    </body>
</html>
a {
    text-decoration:none;
}



#logo {
    text-align: center;
    margin: 0;
}

h1 {
    margin: 0;
    padding-top: 4mm;
    font-size: 2em;
    font-family: 'Lobster', cursive;
    font-weight: normal;
    line-height: 0.8em;
}

h2 {
    font-family: 'Gloria Hallelujah', cursive;
    font-size: 1.5em;
    margin: -5px 0 0;
    font-weight: normal;
}

body{
    font-family: 'Gloria Hallelujah', cursive;
}

a {
    color: #6ab47b;
}

header{
    background: #6ab47b;
    border-color:#599a68;
    float:left;
    margin: 0;
    padding: 5px 0 0 0;
    width: 100%;
}

nav{
    background:  #599a68;
    text-align: center;
    margin: 20px 0 0;
}

nav a, nav a:visited {
    color:#fff;
}

nav ul{
    list-style: none;
    margin: 0 10px;
    padding: 0;
}



nav a{
    font-weight: 800;
    padding: 15px 10px;
}

h1, h2{
    color:#fff;
}

h3{
    margin: 0 0 1em 0;
}

nav a.selected , nav a:hover {
    color:#32673f;
}

footer{
    font-size: 1em;
    text-align: center;
    clear:both;
    padding-top: 20px;
    color: #ccc;
    line-height: 0.8em;
    background: black;
    padding-bottom: 1mm;
}


img{
    max-width: 100%;
}

#gallery img{   
    width: 100%;
}

#gallery{
    margin:0;
    list-style: none; /** remove bullet point **/
}



#gallery li{
    float:left;
    margin: 2.5%;
    background-color: #f5f5f5;
    color: #bdc3c7;
}

#gallery li a p{
    margin: 0;
    padding: 0;
    font-size: 1.5em;
    color: #bdc3c7;
}



.icon{
    width: 40px;
    height: 40px;
    margin: 5mm 5px;
}

body{
    background: orange;
    margin:0;
    color:#999;
}



/******
Page about
******/

.profile-photo{
    display:block;
    max-width:600px;
    margin:0 auto 30px;
    border-radius: 100%;
    padding-top: 10mm;
}



#confu{
    margin-top: 70mm;
}

#context{
    font-family: 'Montserrat', sans-serif; font-size: 1.5em;
}

#aboutsec{
    font-family: 'Pacifico', cursive; font-size:1.5em;
    text-align:center;
}



#mus p{
    margin-top:0;
    padding-top:0;
    line-height: 0.8em;
}

#item_gallery{
    margin:0;
    list-style:none;
}

#item_gallery li{
    float: left;
    padding-top: 22px;
    padding-right: 26px;
    padding-left: 26px;
    width:110px;
}

#item_gallery p,img{
    margin:0;
    padding: 0;
}


#sec{
    height:40cm;
}
#item_gallery li{
  display:inline-block;
  padding-top: 22px;
  padding-right: 26px;
  padding-left: 26px;
  width:110px;
  vertical-align:top;
}