Home  >  Article  >  Web Front-end  >  Frequently Asked Questions in HTML 1

Frequently Asked Questions in HTML 1

php中世界最好的语言
php中世界最好的语言Original
2018-03-08 16:34:202257browse

This time I will bring you some common problems in HTML? How to use ordered lists, unordered lists, and custom lists? Write a simple example. What are the semantic differences between the three? What are the usage scenarios? Can it be nested?

Ordered lists are list items marked with numbers:

<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>

The effect is as follows:

<ol><li>Coffee</li>
<li>Milk</li> </ol>

Unordered lists are lists marked with origins Item:

<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>

The effect is as follows:

<ul><li>Coffee</li>
<li>Milk</li></ul>

The combination of items represented by the custom list plus comments:

<dt>Coffee</dt>
 <dd>Black hot drink</dd><dt>Milk</dt></dl>```

The effect is as follows:

><dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>

These three lists can be nested within each other.
-
#How to remove the dots or numbers at the front of the list?
Just use CSS styles

```<style>ul{
     list-style: none;
}```

-
#What is the difference between class and id? When to use class and when to use id? 1.ID is unique and Class is universal. 2.ID is unique and usually used for
page layout
.
3.Class is repeatable and usually used for style definition.
4. The style priority of ID is higher than Class.
- #What are block-level elements and inline elements? What's the difference? What common tags do they correspond to? Block-level elements usually start (and end) with a new line when displayed by the browser.
Inline elements (
inline elements
) usually do not start on a new line when displayed.
Difference:
1. The block-level element will occupy a row, and its width will automatically fill the width of its parent element. Inline elements will not occupy an exclusive line. Adjacent inline elements will be arranged in the same line. They will not wrap until one line cannot fit. The width will change with the content of the element. 2. Block-level elements can set width , height attribute, inline element setting width, height is invalid3. Block-level elements can set margin and padding. The horizontal padding-left, padding-right, margin-left, margin-right of inline elements all produce margin effects, but the vertical padding-top, padding-bottom
, margin-top,
margin-bottom
will not produce margin effects.
Block-level element tags: div, p,form,ul,li,ol,dl,form,address,fieldset,hr,menu, table.
Inline element labels: span, strong, em, br, img, input, label, select, textarea, cite.
-
#What are the functions of display: block, display: inline, and display: inline-block respectively?

1.display:block: This element will be displayed as a block-level element, and there will be " Newline character. ###2.display:inline: This element will be displayed as an inline element, with no line breaks before and after the element. ###3.display:inline-block: Renders the object as an inline object, but the content of the object is rendered as a block object. Adjacent inline objects will be rendered on the same line, allowing spaces. ###- ####What is the function of the following code? ###
       <div id="header">
        </div>
        <div id="content">
        <div class="main"></div>
        <div class="aside"></div>
        </div>
        <div id="footer">
        </div>

这段代码通过使用id,class对div模块进行布局,让页面呈现为页头,内容,页尾,并且在内容中分为侧栏和主栏部分。而在页面中,header,content,footer仅会出现一次,故用id标记,而content为了后期方便修改,用class标记。
- ####如何理解 HTML CSS 语义化?
通过语义化可以让人们更容易明白每个标签的作用和使用场景,比如p标签就可以理解为paragraph标签,代表一个段落。诸如此类的还有em标签,hx标签,table标签等。
- ####form表单有什么作用?有哪些常用的input 标签,分别有什么作用?
HTML通过form标签创建表单为用户提供文本字段、复选框、单选框、提交按钮等向服务器传输数据。常见的input标签有:
type  规定 input 元素的类型。
src   定义以提交按钮形式显示的图像的 URL。
checked 规定此 input 元素首次加载时应当被选中。
value 规定 input 元素的值。
name 定义 input 元素的名称。
- ####post 和 get 方式的区别?
get以 URL 变量 的形式来发送,将表单数据以名称/值对的形式附加到 URL 中。
post以 HTTP post 的形式来发送,以 HTTP post 事务的方式来传递表单数据。
- ####在input里,name 有什么作用?
name 属性规定 input 元素的名称,用于对提交到服务器后的表单数据进行标识,或者在客户端通过 JavaScript 引用表单数据。
- ####bb9345e55eb71822850ff156dfde57c8提交65281c5ac262bf6d81768915a4a77ac0、dc70b20ff58391e5e1b770945ac685fa提交5db79b134e9f6b82c0b36e0489ee08ed、892fc1b3743fe80ae197d7a1a60c2276三者有什么区别?
1.bb9345e55eb71822850ff156dfde57c8提交65281c5ac262bf6d81768915a4a77ac0定义一个按钮,。bb9345e55eb71822850ff156dfde57c8 与 65281c5ac262bf6d81768915a4a77ac0 标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。
2.dc70b20ff58391e5e1b770945ac685fa提交5db79b134e9f6b82c0b36e0489ee08ed是一个a标签定义的超链接,而其样式用class="btn"标记。
3.892fc1b3743fe80ae197d7a1a60c2276定义了提交按钮,点击并向服务器发送表单数据。数据会发送到表单的 action 属性中指定的页面。
- ####radio 如何分组?
在input标签中添加name属性进行分组。
- ####placeholder 属性有什么作用?
placeholder 属性提供可描述输入字段预期值的提示信息(hint)。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。
- ####type=hidden隐藏域有什么作用?举例说明
隐藏域在页面中对于用户是不可见的,在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序

所使用。浏览者单击发送按钮发送表单的时候,隐藏域的信息也被一起发送到服务器。

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

简述CSS中clearfix 的原理

CSS常见样式

怎样用CSS3制作登录框

CSS的选择器有哪些常见问题

The above is the detailed content of Frequently Asked Questions in HTML 1. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn