英文:
Can a list be numbered list be over multiple divs?
问题
我需要允许搜索引擎阅读一个编号列表,但是这些步骤跨越了多个
- 元素中。
例如,如果我有以下结构:
<div>
<div>
<h3>step 1</h3>
</div>
<div>
<p>step 1 text</p>
</div>
<div>
<img src="Step 1 image.jpg" />
</div>
</div>
<div>
<div>
<h3>step 2</h3>
</div>
<div>
<p>step 2 text</p>
</div>
<div>
<img src="Step 2 image.jpg" />
</div>
</div>
<div>
<div>
<h3>step 3</h3>
</div>
<div>
<p>step 3 text</p>
</div>
<div>
<img src="Step 3 image.jpg" />
</div>
</div>
我能够让搜索引擎将其理解为一个编号列表吗?
英文:
Can't seem to find the answer to this but I need to allow search engines to read a numbered list. However, the steps are spanned over multiple divs (all with their own images etc) and without rewriting the code (e.g. changing the divs), I wondered if it was possible to allow search engines to understand the list.
I can add content inside the divs etc without messing up the layout e.g. li but the li would be in multiple divs and I'm not sure if bing/google could understand if 1,2,3 are not all inside the same ol
e.g.
If I had
<div>
<div>
<h3>step 1</h3>
</div>
<div>
<p>step 1 text</p>
</div>
<div>
<img src="Step 1 image.jpg" />
</div>
</div>
<div>
<div>
<h3>step 2</h3>
</div>
<div>
<p>step 2 text</p>
</div>
<div>
<img src="Step 2 image.jpg" />
</div>
</div>
<div>
<div>
<h3>step 3</h3>
</div>
<div>
<p>step 3 text</p>
</div>
<div>
<img src="Step 3 image.jpg" />
</div>
</div>
could I get a search engine to understand it as a numbered list?
答案1
得分: 0
你可以使用相关的CSS代码:
div {
border: 1px green solid;
/* 在 div 上使用 easyclearing(或此解决方法) */
overflow: auto;
height: auto;
}
/* 清除浮动 */
ul + * { clear: both; }
ul {
float: left;
height: 160px; /* (30 + 2px) * 5 */
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
li:nth-child(5n+1) { clear: right; }
li {
width: 30px;
height: 30px;
float: right;
margin: 1px;
background: #ccc;
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
希望对你有帮助。
英文:
You can use relevant css
div {
border : 1px green solid;
/* use easyclearing on div (or this workaround) */
overflow : auto;
height : auto;
}
/* clear */
ul + * { clear: both; }
ul {
float : left;
height : 160px; /* (30 + 2px) * 5 */
-webkit-transform : rotate(-90deg);
-moz-transform : rotate(-90deg);
-ms-transform : rotate(-90deg);
-o-transform : rotate(-90deg);
transform : rotate(-90deg);
}
li:nth-child(5n+1) { clear: right; }
li {
width : 30px;
height : 30px;
float : right;
margin : 1px;
background : #ccc;
-webkit-transform-origin : 50% 50%;
-moz-transform-origin : 50% 50%;
-ms-transform-origin : 50% 50%;
-o-transform-origin : 50% 50%;
transform-origin : 50% 50%;
-webkit-transform : rotate(90deg);
-moz-transform : rotate(90deg);
-ms-transform : rotate(90deg);
-o-transform : rotate(90deg);
transform : rotate(90deg);
}
I hope it will help you.
答案2
得分: 0
是的,Bing/Google可能会将位于不同ol标记内的单独的li标记视为不同列表的项!
这是我会做的,我会将这些div封装在一个唯一的ol标记内,同时移除样式。
<ol>
<li>
<div>
<div>
<h3>步骤 1</h3>
</div>
<div>
<p>步骤 1 文本</p>
</div>
<div>
<img src="Step 1 image.jpg" />
</div>
</div>
</li>
<li>
<div>
<div>
<h3>步骤 2</h3>
</div>
<div>
<p>步骤 2 文本</p>
</div>
<div>
<img src="Step 2 image.jpg" />
</div>
</div>
</li>
<li>
<div>
<div>
<h3>步骤 3</h3>
</div>
<div>
<p>步骤 3 文本</p>
</div>
<div>
<img src="Step 3 image.jpg" />
</div>
</div>
</li>
</ol>
希望这有所帮助,:).
英文:
Yes, Bing/Google would probably see separate li tags inside differents ol tag as items from different lists!
This is what I would do, I would encapsulate the divs inside a unique ol, removing the styling.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
ol {
list-style: none;
margin: 0;
padding: 0;
}
li {
margin: 0;
padding: 0;
}
<!-- language: lang-html -->
<ol>
<li>
<div>
<div>
<h3>step 1</h3>
</div>
<div>
<p>step 1 text</p>
</div>
<div>
<img src="Step 1 image.jpg" />
</div>
</div>
</li>
<li>
<div>
<div>
<h3>step 2</h3>
</div>
<div>
<p>step 2 text</p>
</div>
<div>
<img src="Step 2 image.jpg" />
</div>
</div>
</li>
<li>
<div>
<div>
<h3>step 3</h3>
</div>
<div>
<p>step 3 text</p>
</div>
<div>
<img src="Step 3 image.jpg" />
</div>
</div>
</li>
</ol>
<!-- end snippet -->
hope it helps, :).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
- html
- html-lists
评论