首页 > 解决方案 > 左边距让我缩进错误

问题描述

我想知道边距属性如何影响我设置为内联显示的元素。

我知道对于内联元素是不可能使用上边距和下边距的,并且有了这个左边距,浏览器会在顶部而不是向左缩进。小边距也在底部,但不在左侧。

是否可以向左缩进?

/* Reset CSS template , maybe can be here some connection with my problem too */

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
  display: block;
}

body {
  line-height: 1;
}

ol,ul {
  list-style: none;
}

blockquote,q {
  quotes: none;
}

blockquote:before,blockquote:after,q:before,q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Here I´m including my CSS file */

/* My CSS file */

nav {
  margin-right: 10px;
  display: inline;
}
<p> Autorem článku je Aleš Fišer,kontaktovat ho můžete na této <a href="#adresa">adrese</a></p>
<nav>
  <header role="banner" id="zahlavi">
    <nav role="navigation">
      <ul id="navigácia">
        <li>České Budějovice</li>
        <!-- Here starts my nav -->
        <li>Telč</li>
        <li>Moravské Budějovice</li>
      </ul>
    </nav>
    <h1>Návštěvníci se pomalu chystají na začátek sezóny</h1>

甚至可以使用 navdisplay: inline吗?我想让我的导航水平,在一排,但遗憾的是什么也没发生,我也没有子弹(可能与边距有关)。我该如何解决?
这就是我的代码

标签: htmlcssmargininlineindentation

解决方案


推荐阅读