简体   繁体   English

如何在 HTML 中缩进列表

[英]How to indent list in HTML

I am having a small issue when it comes to creating an indented list.在创建缩进列表时我遇到了一个小问题。 I thought of posting the html and have someone's help on what the css should be.我想发布 html 并请人帮助了解 css 应该是什么。

Basically it should say the link 'It's a very simple process' and this should not have a bullet point, it's just a sentence.基本上它应该说链接“这是一个非常简单的过程”,这不应该有要点,它只是一个句子。

Then below that line (no space between), the ordered list should should be indented within.然后在该行下方(之间没有空格),有序列表应缩进。

How to do this?这该怎么做?

 <ul class="nobullet"> <li>It's a very simple process: <ol> <li>Send an email to <b>xxx@xxx.com</b> requesting to join our talent pool along with your CV attached.</li> <li>We will send you a form to complete where you can state your preferred roles and locations.</li> <li>You relax and we will communicate with our business clients on a weekly basis for available roles.</li> <li>We will send you job specifications that match your preference.</li> </ol> </li> </ul>

Not sure about the indenting.. you mean you want the 1,2,3 to be indented as well?不确定缩进.. 你的意思是你想要 1,2,3 也缩进?

for the bullet point just add "list-style-type: none" to your class in the css.对于要点,只需将"list-style-type: none"添加到 css 中的 class。

 .nobullet{ list-style-type: none; }
 <ul class="nobullet"> <li>It's a very simple process: <ol> <li>Send an email to <b>xxx@xxx.com</b> requesting to join our talent pool along with your CV attached.</li> <li>We will send you a form to complete where you can state your preferred roles and locations.</li> <li>You relax and we will communicate with our business clients on a weekly basis for available roles.</li> <li>We will send you job specifications that match your preference.</li> </ol> </li> </ul>

Perhaps think about changing the HTML then.或许可以考虑改成 HTML 吧。 If " It's a very simple process: " is not a bullet point then simply change it to a <h3> or <h4> .如果“这是一个非常简单的过程: ”不是要点,则只需将其更改为<h3><h4>即可。 You need to think about accessability too...你也需要考虑可访问性......

 <h3>It's a very simple process:</h3> <ol> <li>Send an email to <b>xxx@xxx.com</b> requesting to join our talent pool along with your CV attached.</li> <li>We will send you a form to complete where you can state your preferred roles and locations.</li> <li>You relax and we will communicate with our business clients on a weekly basis for available roles.</li> <li>We will send you job specifications that match your preference.</li> </ol>

Do you plan to have more <li> elements in your unordered list?你打算在你的无序列表中加入更多的<li>元素吗?

**just put **只是放

put this text: It's a very simple process -> in h1 tag or any把这个文本:这是一个非常简单的过程 -> 在 h1 标签或任何

in place of list tag代替列表标签

this tag it does not need**它不需要这个标签**

add in css: 在css中添加:

list-style:none;列表样式:无;

You can change the marker with the list-style-type property.您可以使用list-style-type属性更改标记。

ul.nobullet {
  list-style-type: none;
}

If you want to change the indentation, you can use padding and margin values.如果要更改缩进,可以使用填充和边距值。 When styling list indentation, I like to set both padding-left and margin-left for both the list and list item elements to ensure that indentation from both padding and margin are set as desired (I'm not sure that all browsers indent their lists with the same properties).在设置列表缩进样式时,我喜欢为列表和列表项元素同时设置 padding-left 和 margin-left 以确保根据需要设置 padding 和 margin 的缩进(我不确定所有浏览器都缩进他们的列表具有相同的属性)。 This will indent all lists 4 ems:这将使所有列表缩进 4 em:

ul, 0l {
  margin-left: 0;
  padding-left: 4em;
}
li {
  margin-left: 0;
  padding-left: 0;
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM