<div>标签如何支持HTML代码?
How does the <div> tag support HTML code?
我一直在搜索 Google 和其他搜索引擎产品并搜索:
What is <div>
used for in HTML?
这是我得到的:
The <div>
tag defines a division or a section in an HTML document. The <div>
tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The <div>
tag is easily styled by using the class or id attribute. Any sort of content can be put inside the <div>
tag!
这是真的吗?我想听听专业人士的意见。 HTML里面的内容怎么划分? “正文”属性是我的另一个问题,但我一次只能问一个问题。
看看我的代码,<div>
我发现根本没有帮助:
<!DOCTYPE html>
<h1> Example Title </h1>
<p> Example Paragraph referring to the Example Title.</p>
<div id="div"/>
<progress onload="https://google.com"></progress>
</div>
<div>
如何帮助 <progress>
属性? <div>
真的有什么帮助吗?
是的,在 div 标签中你可以放任何你想要的东西。
因为我们都想要干净易读的代码,所以最好有具有特殊含义的标签,这就是为什么有一个东西叫做:语义html。
What are Semantic Elements?
A semantic element clearly describes its meaning to both the browser and the developer.
随心所欲地使用 div 标签并没有错。但将来您或您的开发团队成员在阅读和理解您的代码时会遇到问题。
正如邪猴在评论中所说:
div 是一个容器。例如:
<div class="any-class">
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article>
</div>
width the div with class .any-class,例如,您可以设置整个内容的样式或在其上使用 javascript 或...
尽量避免过度使用 div 标签,如下所示:
<div class="any-class">
<div>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p
</div>
<div>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</div>
<div>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</div>
</div>
这里有一个关于语义的小“教程”-html
https://www.w3schools.com/html/html5_semantic_elements.asp
如果您想对一个或多个元素执行 css,Div 标签很好。如果您查看了 bootstrap 文档,那么它们的一些很好的例子就是,因为要使用该框架的很多内容,您需要使用 div 来引用 类.
我一直在搜索 Google 和其他搜索引擎产品并搜索:
What is
<div>
used for in HTML?
这是我得到的:
The
<div>
tag defines a division or a section in an HTML document. The<div>
tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The<div>
tag is easily styled by using the class or id attribute. Any sort of content can be put inside the<div>
tag!
这是真的吗?我想听听专业人士的意见。 HTML里面的内容怎么划分? “正文”属性是我的另一个问题,但我一次只能问一个问题。
看看我的代码,<div>
我发现根本没有帮助:
<!DOCTYPE html>
<h1> Example Title </h1>
<p> Example Paragraph referring to the Example Title.</p>
<div id="div"/>
<progress onload="https://google.com"></progress>
</div>
<div>
如何帮助 <progress>
属性? <div>
真的有什么帮助吗?
是的,在 div 标签中你可以放任何你想要的东西。
因为我们都想要干净易读的代码,所以最好有具有特殊含义的标签,这就是为什么有一个东西叫做:语义html。
What are Semantic Elements? A semantic element clearly describes its meaning to both the browser and the developer.
随心所欲地使用 div 标签并没有错。但将来您或您的开发团队成员在阅读和理解您的代码时会遇到问题。
正如邪猴在评论中所说: div 是一个容器。例如:
<div class="any-class">
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article>
</div>
width the div with class .any-class,例如,您可以设置整个内容的样式或在其上使用 javascript 或...
尽量避免过度使用 div 标签,如下所示:
<div class="any-class">
<div>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p
</div>
<div>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</div>
<div>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</div>
</div>
这里有一个关于语义的小“教程”-html https://www.w3schools.com/html/html5_semantic_elements.asp
Div 标签很好。如果您查看了 bootstrap 文档,那么它们的一些很好的例子就是,因为要使用该框架的很多内容,您需要使用 div 来引用 类.