gpt4 book ai didi

html - 尝试了解如何使用自定义 Drupal 主题显示图像

转载 作者:行者123 更新时间:2023-11-27 22:58:35 25 4
gpt4 key购买 nike

我正在尝试了解如何创建 Drupal 8 自定义主题。我对此有一些疑问,但我无法在文档或其他方面找到真正的答案。有人可以帮我吗?

我用这些信息创建了一个 libraries.yml 和 theme_info.yml:

name: Cosplay Academy
type: theme
description: 'A cuddly theme that offers extra fluffiness.'
core: 8.x
libraries:
- cosplayacademy/global-styling-and-scripts
regions:
header: Header
primary_menu: 'Primary menu'
secondary_menu: 'Secondary menu'
page_top: 'Page top'
page_bottom: 'Page bottom'
highlighted: Highlighted
featured_top: 'Featured top'
breadcrumb: Breadcrumb
content: Content
sidebar_first: 'Sidebar first'
sidebar_second: 'Sidebar second'
featured_bottom_first: 'Featured bottom first'
featured_bottom_second: 'Featured bottom second'
featured_bottom_third: 'Featured bottom third'
footer_first: 'Footer first'
footer_second: 'Footer second'
footer_third: 'Footer third'
footer_fourth: 'Footer fourth'
footer_fifth: 'Footer fifth'
global-styling-and-scripts:
version: VERSION
css:
theme:
css/plugins/bootstrap.min.css: {}
css/style.css: {}
css/skin-modes.css: {}
css/icons.css: {}
css/plugins/horizontal-menu.css: {}
css/colors/color6.css: {}

我在我的 html 标记中看到了我的 css 文件,但在它之前有很多 css 文件。为什么 ?我可以删除它们吗?

此外,我正在尝试将图像显示到 data-image-src 中,但它不会显示:/当我查看我的 html 标记并复制图像 url 时,它起作用了,我可以看到它,但我无法在我的页面中看到它...我完全迷路了:/

正如您在下面看到的,我的 css 文件加载到最后,我的图像没有出现...

No image on my page

Drupal CSS Files

最佳答案

额外的 css 文件:
您看到的额外 css 文件是由 drupal 核心和已启用的各种模块添加的。我可以通过包含的 css 文件看到您在查看此页面时已登录,例如,它使工具栏 css 包含在页面中。当以匿名用户身份查看页面时,大多数这些 css 文件都不会被包含。
你不应该担心这些,当网站上线时,你会在“性能”设置下设置 css 和 javascript 聚合,这些将组合成几个文件,只包含需要的内容。

数据-img-src:
我不确定您希望添加“data-img-src”会发生什么??
要在 img 标签上设置图像路径,您只需使用“src”属性即可。
任何以“data-”开头的属性都只是一个数据存储,例如,您可能希望与某些 javascript 一起使用。

有关数据属性的更多信息:
https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
https://www.sitepoint.com/use-html5-data-attributes/
https://www.w3schools.com/tags/att_global_data.asp

关于html - 尝试了解如何使用自定义 Drupal 主题显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59110461/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com