css中div和spand,You can still use div

2023-10-27 19:10
文章标签 use css div frontend still spand

本文主要是介绍css中div和spand,You can still use div,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

48 Responses on the article “You can still use div”

9767673d472c2f27307890c27061bca3?s=48&d=mm&r=gzcorpan says:

> * For those who haven’t encountered this term before, flow content elements are the same as HTML 4’s block-level content elements.

No, it’s not. It’s similar to HTML4’s %flow. That is, both block-level and inline elements.

23d652ae02bcd0eda1632d4065e7f8f6?s=48&d=mm&r=gfjpoblam says:

Yes! Most assuredly I use divs. As you described, I use a div now and then to call the reader’s attention to a couple of sections in an independently-styled block. A good example for me is, an inset box floated to the right of the main text, shaded and with a border, with perhaps a “Did you know?” section and a “For more information…” section.

c39a67e8c57bb8e751a5abcb70c580ad?s=48&d=mm&r=gsays:

Shouldn’t the Element be used to wrap the intro to a text?

cee2441ba1a36804b932b265c8511281?s=48&d=mm&r=gdj says:

Does this mean those html grid systems, with a gazillion div’s, will go away? Thx

719be00c69e640734ac8896f4b7fcfaf?s=48&d=mm&r=gRobson Sobral says:

I’m missing the “role” attribute. It is so useful!

63a3e08a9f401ece4452137e5dc8e24a?s=48&d=mm&r=gskottey says:

When I look under the hood of some sites built in HTML5, I often do not see any elements in use at all, which is scary to me. The overuse of , and other new HTML5 elements, does not always make sense, semantically. While the overuse of the element can potentially make the markup messy and bloated (depending on where and why it is being used), it will always be the greatest tool when styling is needed on a block of content (exactly as this article states).

I should also mention that I literally just had “” tattooed on my left wrist, and “” on my right wrist just five days ago. I have strong feelings for it.

63a3e08a9f401ece4452137e5dc8e24a?s=48&d=mm&r=gskottey says:

When I look under the hood of some sites built in HTML5, I often do not see any

elements in use at all, which is scary to me. The overuse of , and other new HTML5 elements, does not always make sense, semantically. While the overuse of the
element can potentially make the markup messy and bloated (depending on where and why it is being used), it will always be the greatest tool when styling is needed on a block of content (exactly as this article states).

I should also mention that I literally just had

tattooed on my left wrist, and
on my right wrist just five days ago. I have strong feelings for it.

Good article, though I wouldn’t focus as much on the stylistic needs for using divs.

When there is a need to style, it usually comes forth of a need to structure. I use a site (page) wrapper too, but I use it to differentiate the page content from possible overlays which lie outside the natural content of my page. That way the wrapper leaves enough room for structural flexibility, even when there are no overlays defined.

Nice! I’m working HTML5 and I’m using for align the element block. and for elements children

9d8e813f9b06287c0c046184b015b3c1?s=48&d=mm&r=gDavid Rocks says:

Still have questions. If sections are not to be used to create containers and/or for styling, it seems that that the use of html5 will see an expansion of file sizes as the ‘semantic’ elements are added for semantic purposes while we still carry around all the div statements for physical structure and styling of such. This seems especially hard for CMS’s that integrate multiple chunks of specialized html. Is

&ltdiv id=comment&gt

&ltarticle&gt

better than

&ltarticle id=comment&gt ?

7ebc16d35a631efd7ebd9212a979abf4?s=48&d=mm&r=geFBé says:

i loved to have a wrapper tag named like and which could have been the real wrapper of the whole content under body. maybe next time :)

[…] article, read it by yourself at HTML5Doctor This entry was posted in Uncategorized. Bookmark the permalink. ← New site, […]

87a7c32f07a2aaf22207efe1a93a2409?s=48&d=mm&r=gMatthieu Delahaye says:

David: I think you slightly misunderstood Mike. You may style sections, but you may not add sections for the sole purpose of styling if the contained element do not represent a logical subdivision of your content.

But that’s for the ideal HTML5. However in on a practical case this is different if you want to author HTML5 today while there is still a significant amount of browser that do not understand it.

If you take for instance IE, you cannot style unknown tags and in this specific situation article, section and al are in this case. As Mike evoked it, you may use javascript to make IE understand them, but this only work if javascript is enabled. Therefore, relying on additional div for styling is required in this case. Indeed you would see an increase of tags, but this is transitional (and when you see how many IE6 are still in use, you can infer the transition will be long).

9d8e813f9b06287c0c046184b015b3c1?s=48&d=mm&r=gDavid Rocks says:

re: M/ Delahaye. Makes sense but will be an effort in reality I think. Code purpose change as they evolve and I think I will spend some time going back over code to be comfortable about appropriate use of html5. But then, code review never really hurts.

I expect that htmlshiv.js or modernizr.js will suffice for older browsers for now as I’m not sure I need to worry about javascript being turned off that much. Is this more likely than running ie6?

[…] You can still use div | HTML5 Doctor. This entry was posted in Uncategorized. Bookmark the […]

imo, using new tag are someway to other people working on it really know what it mean!

When you put ,.. ,,,no one know really what u means if they user other language like …etc

Using makes it more clear and make the front-end development easier!

I wish with html6, we never worry about special , tag will be anything we want! Looks at this markup:

quite beautiful, right?

[…] If you need a

for styling purposes, that’s perfectly fine. You could also achieve the same effect by doing as you suggest and setting a background on the element. For more, take a look at our recent article You can still use
. […]

Thank you for the great information. I am a web builder. I am always used this tag for templates development and alignment setting. In my point of view the tag is a very powerful tool for Web developers. I know most of them web developers are using this tag instead of tag for alignment setting and designing. This tag used to we can easily make CSS code. Many internet research writers are written an article and blog about web designing and CSS designing. You can easily buy research papers template development techniques of web templates and coding system.

[…] You can still use div | HTML5 Doctor (html5doctor.com) […]

070a3720cd8c276c52c492ab3c059640?s=48&d=mm&r=gJoff says:

I’ve started to feel that I’ve been overusing the section element so this article’s helped to confirm my fears. Should I be using divs more for “sections” of the page, such as containers for non-textual elements? (Banners, etc)

Of course, if you only want to style the first paragraph, you could use a CSS selector like h1 + p {} or article p:first-child {}.

In that case, “article p:first-child {}” wouldn’t work – ‘p’ isn’t the first child of ‘article’, the ‘h1’ is. It should be “article p:first-of-type {}”.

“:first-child” always trips me up.

[…] HTML5 Doctor (a community site I co-curate) including You can still use div […]

[…] HTML5 Doctor (a community site I co-curate) including You can still use div […]

c21286da7e741bd3d94e20124bb91887?s=48&d=mm&r=gDan says:

@skottey:

I should also mention that I literally just had tattooed on my left wrist, and on my right wrist just five days ago. I have strong feelings for it.

So, you didn’t close the div?

You aren’t a div unto yourself?

;-)

c21286da7e741bd3d94e20124bb91887?s=48&d=mm&r=gDan says:

pfft.

I should also mention that I literally just had < div> tattooed on my left wrist, and < div> on my right wrist just five days ago. I have strong feelings for it.

Hi Friends,

I really dont like the using the divs, it really sucks.

Is it fine I to keep using table tag, become it is really easy to do.

Please give ur suggestions.

[…] используйте старые добрые

’ы. С приходом HTML5
’ы не умерли, и именно они отлично подходят в этом случае. Принимая […]

[…]

Blog post title

Blog post content

The document is untitled. Somewhat reluctantly, Johansson settles on marking up the website’s title in h1 and using another h1 to mark up the article’s title. This is a sensible solution and is backed up by the results of the WebAIM screenreader user survey, in which the majority of respondents stated a preference for two top-level headings in exactly this format. This same approach is also widely used on static pages that are built with HTML5 structural elements, and it could be very useful indeed for screen reader users. Imagine that you are using a screen reader to find a decent recipe for chicken pie, and you have a handful of recipe websites open for comparison. Being able to quickly find out which website you are on using the shortcut key for headings would be much more useful than seeing only “chicken pie” on each one. Not too far behind two top-level headings in the screen reader user survey was one top-level heading for the document. This is probably my preferred option in most cases; but as we have already seen, it creates an untitled body, which is undesirable. In my opinion, there is an easy way around this problem: don’t use article as a wrapper for single-blog posts, news items or static page main content. Remember that article is sectioning content: it creates a sub-section of the document. But in these cases, the document is the content, and the content is the document. Setting aside the name of the element, why would we want to create a sub-section of a document before it has even begun? Remember, you can still use div! […]

f800021521ce981f81a7b0e6f5183ed6?s=48&d=mm&r=gsays:

I really enjoy this article, and the use of div’s

thank you.

81e6be940dce354a75cf1533512009af?s=48&d=mm&r=gStnCham says:

@Dan

So, you didn’t close the div?

You aren’t a div unto yourself?

Ha!

@skottey

I should also mention that I literally just had < div> tattooed on my left wrist, and < div> on my right wrist just five days ago. I have strong feelings for it.

You know, since you didn’t close, you’ll not validate. :P

Pretty darn helpful. I’m new to HTML 5 but it’s nice how there are overlaps. Personally, I run a college advice site and am mainly focused on writing, but knowing a few HTML hacks never hurts.

[…] or as html5doctor concluded: You should use 

when there is no other more semantically appropriate element that suits your purpose. Its most common use will likely be for stylistic purposes — i.e., wrapping some semantically marked-up content in a CSS-styled container. (full article: http://html5doctor.com/you-can-still-use-div/) […]

d6f24c073365bd221e5e9e4de76419c8?s=48&d=mm&r=gsmcdee says:

Thanks so much – very helpful…

0fff9b5aee949e63667e35c162390751?s=48&d=mm&r=gTim says:

I disagree with wrapping the p with an intro div. Why not just put the class on the p itself. It makes no sense to use a div there. It’s less semantic, bloats up the markup, adds a nonsensical hierarchy, and provides no value. You are specifying that the p is special in a certain way, so the class goes on the p, you don’t use extra markup to specify that.

@Tim – If you take a closer look at my example you’ll see I have two paragraphs in the “intro”

. The appropriateness of a wrapper
is entirely subjective. Maybe your intro paragraph(s) could be styled directly with classes, or maybe they need the aid of a
. As with most scenarios in HTML, think about what you are trying to achieve and craft the most semantic, usable and accessible solution.

If you take for instance IE, you cannot style unknown tags and in this specific situation article, section and al are in this case. As Mike evoked it, you may use javascript to make IE understand them, but this only work if javascript is enabled. Therefore, relying on additional div for styling is required in this case. Indeed you would see an increase of tags, but this is transitional (and when you see how many IE6 are still in use, you can infer the transition will be long).

Thanks a lot, your post made it much clearer to me.

Luckily, no need to rewrite already existing and working markup :-) Nice

1e0e5f830359944246099ad514245b82?s=48&d=mm&r=globwedge says:

You’ve got it completely wrong… it’s all the way down!

c2034f24fee7f973ef8d0b80cf42c821?s=48&d=mm&r=glance says:

Ok so I’m completely way behind here. I have been hesitant on using ‘section’, ‘article’, etc. I would like to start using these more though I have been implementing ‘header’ and ‘footer’ for a sometime now. In the world of interwebs information regarding what is the most concrete thing to do can be fuzzy at times. I’d much rather prefer someone say, “no more divs” :) It makes it more concrete and less confusing. When someone looks at my code, I don’t want them going, “Ha they’re using html5 doctype and have no damn sections or articles…all I see is divs.” Good article. I will still use my divs

Join the discussion.

Name (required)

Mail (will not be published) (required)

Website

Some HTML is ok

You can use these tags:

You can also use , and remember to use < and > for brackets.

Enter comment

Notify me of followup comments via e-mail

这篇关于css中div和spand,You can still use div的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/287772

相关文章

详解Vue如何使用xlsx库导出Excel文件

《详解Vue如何使用xlsx库导出Excel文件》第三方库xlsx提供了强大的功能来处理Excel文件,它可以简化导出Excel文件这个过程,本文将为大家详细介绍一下它的具体使用,需要的小伙伴可以了解... 目录1. 安装依赖2. 创建vue组件3. 解释代码在Vue.js项目中导出Excel文件,使用第三

Java实现Excel与HTML互转

《Java实现Excel与HTML互转》Excel是一种电子表格格式,而HTM则是一种用于创建网页的标记语言,虽然两者在用途上存在差异,但有时我们需要将数据从一种格式转换为另一种格式,下面我们就来看看... Excel是一种电子表格格式,广泛用于数据处理和分析,而HTM则是一种用于创建网页的标记语言。虽然两

vue解决子组件样式覆盖问题scoped deep

《vue解决子组件样式覆盖问题scopeddeep》文章主要介绍了在Vue项目中处理全局样式和局部样式的方法,包括使用scoped属性和深度选择器(/deep/)来覆盖子组件的样式,作者建议所有组件... 目录前言scoped分析deep分析使用总结所有组件必须加scoped父组件覆盖子组件使用deep前言

VUE动态绑定class类的三种常用方式及适用场景详解

《VUE动态绑定class类的三种常用方式及适用场景详解》文章介绍了在实际开发中动态绑定class的三种常见情况及其解决方案,包括根据不同的返回值渲染不同的class样式、给模块添加基础样式以及根据设... 目录前言1.动态选择class样式(对象添加:情景一)2.动态添加一个class样式(字符串添加:情

React实现原生APP切换效果

《React实现原生APP切换效果》最近需要使用Hybrid的方式开发一个APP,交互和原生APP相似并且需要IM通信,本文给大家介绍了使用React实现原生APP切换效果,文中通过代码示例讲解的非常... 目录背景需求概览技术栈实现步骤根据 react-router-dom 文档配置好路由添加过渡动画使用

使用Vue.js报错:ReferenceError: “Vue is not defined“ 的原因与解决方案

《使用Vue.js报错:ReferenceError:“Vueisnotdefined“的原因与解决方案》在前端开发中,ReferenceError:Vueisnotdefined是一个常见... 目录一、错误描述二、错误成因分析三、解决方案1. 检查 vue.js 的引入方式2. 验证 npm 安装3.

vue如何监听对象或者数组某个属性的变化详解

《vue如何监听对象或者数组某个属性的变化详解》这篇文章主要给大家介绍了关于vue如何监听对象或者数组某个属性的变化,在Vue.js中可以通过watch监听属性变化并动态修改其他属性的值,watch通... 目录前言用watch监听深度监听使用计算属性watch和计算属性的区别在vue 3中使用watchE

python解析HTML并提取span标签中的文本

《python解析HTML并提取span标签中的文本》在网页开发和数据抓取过程中,我们经常需要从HTML页面中提取信息,尤其是span元素中的文本,span标签是一个行内元素,通常用于包装一小段文本或... 目录一、安装相关依赖二、html 页面结构三、使用 BeautifulSoup javascript

Vue3 的 shallowRef 和 shallowReactive:优化性能

大家对 Vue3 的 ref 和 reactive 都很熟悉,那么对 shallowRef 和 shallowReactive 是否了解呢? 在编程和数据结构中,“shallow”(浅层)通常指对数据结构的最外层进行操作,而不递归地处理其内部或嵌套的数据。这种处理方式关注的是数据结构的第一层属性或元素,而忽略更深层次的嵌套内容。 1. 浅层与深层的对比 1.1 浅层(Shallow) 定义

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template