目录
什么是Materialize CSS?
什么是对话框?
Dialogs in Materialize CSS
语法
Parameter
Example
示例
Conclusion
首页 web前端 css教程 解释 Materialise CSS 中的对话框

解释 Materialise CSS 中的对话框

Aug 19, 2023 pm 08:49 PM

Explain Dialogs in Materialize CSS

由于Materialize内置的响应式设计,使用它制作的网站可以自动调整大小以适应不同的设备类型。Materialize类是为了使网站适应任何屏幕尺寸而开发的。所有的个人电脑、平板电脑和移动设备都可以访问使用Materialize构建的网站。

Materialize的设计是扁平且极其简单的。它是根据这样的理解而制作的:添加新的CSS规则要比更改已经存在的规则简单得多。它支持阴影和鲜艳的色调。在所有平台和设备上,色调和色调都是一致的。可能最重要的是,使用它完全免费。

在本文中,我们将讨论Materialize CSS中的对话框。

什么是Materialize CSS?

Materialize CSS是一个使用CSS、JavaScript和HTML开发的用户界面组件库。谷歌是设计它的公司。Material Design是CSS的另一个名称。它是一种将创新和技术与良好设计的经典原则融合在一起的设计语言。谷歌希望创建一个设计框架,以实现在任何平台上所有产品上的一致用户体验。

It is a set of UI components created by Google. It is used to build online pages and web apps that are aesthetically pleasing, consistent, and useful while adhering to contemporary web design concepts like browser portability, device independence, and gentle degradation. It is a conventional CSS with a small footprint.

It is open source and needs the jQuery JavaScript library to work correctly. It may be used to build reusable web components and is cross-browser compatible. Cards, tabs, navigation bars, toasts, and more upgraded and customized features are included. It offers updated variations of typical user interface elements like buttons, checkboxes, and text fields that have been modified to adhere to Material Design principles.

什么是对话框?

对话框是一种图形控件元素,以小窗口的形式出现,并向用户传达信息,同时要求用户做出反应。

Depending on whether they prevent communication with the software that opened the dialog, dialog boxes are categorized as "modal" or "modeless." The desired user interaction determines the type of dialogue box that will be displayed.

HTML元素"dialog"表示对话框或其他交互元素,如子窗口、检查器或可关闭的警告。

Dialogs in Materialize CSS

Dialogs in Materialize CSS give users access to more information as needed. These are not immediately displayed on the website. The information needed at that particular time is related to the dialog transitions. In order to display dialogs, Materialize offers several options. Dialogs are pieces of material that are normally hidden on a page but pop up with more information when required. The user shouldn't feel startled by the changes, which should make sense from the dialog's appearance. Toasts in Materialize give you a simple way to give your users discreet alerts. You may test out how responsively these toasts are put and sized by clicking the button below on various device sizes.

Use JavaScript code to programmatically invoke the Materialize.toast() function to accomplish this. An HTML String may also be supplied as the first argument. Once the toast has been dismissed, you can have it call back a certain function. You can easily customize the CSS style classes and add it to the toasts as as optional parameter.

语法

Materialize.toast(content, timeDuration, class, callback); 
登录后复制

Parameter

  • Content- It is used to specify the content to be displayed on the user’s screen.

  • timeDuration- 用于指定在屏幕上显示消息的时间持续时间。

  • Class- 用于指定要应用于提示框的样式类的类型。

  • Callback- It is used to specify the callback method which is to be called after the toast is dismissed.

The following Materialize and CDN link needs to written within the tag −

<link rel = “stylesheet” href = “https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css”>
<script type = “text/javascript” src = “https://code.jquery.com/jquery2.1.1.min.js”> </script>
<script src = “https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js”> </script>
登录后复制

Example

的中文翻译为:

示例

The given below example exemplifies how to add different types of dialog boxes in a web page using Materialize CSS.

<!DOCTYPE html>
<html>
<head>
   <title> Dialogs in Materialize CSS </title>
   <meta name= "viewport" content= "width = device-width, initial-scale = 1">
   <link rel= "stylesheet" href= "https://fonts.googleapis.com/icon?family=Material+Icons">
   <link rel= "stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
   <script type= "text/javascript" src= "https://code.jquery.com/jquery-2.1.1.min.js"> </script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
   <script>
      function Box1(content, timeDuration) {
         Materialize.toast( '<b>' + content + '</b>', timeDuration, 'rounded' );
      }
      function Box2(content, timeDuration) {
         Materialize.toast('<em>' + content + '</em>', timeDuration );
      }
      function Box3(content, timeDuration) {
         Materialize.toast( '<u>' + content + '<u>', timeDuration );
      }
   </script>
</head>
<body class= "container">
   <h2 style= "textalign:center"> Materialize CSS </h2>
   <h4> Different Dialog boxes </h4>
   <a class= "btn" onclick= "Box1('Bold N rounded Alert!', 2000)"> Bold And rounded Alert box!! </a> <br> <br>
   <a class= "btn" onclick= "Box2('Emphasized Alert!', 2000)"> Emphasized Alert box!! </a> <br> <br>
   <a class= "btn" onclick= "Box3('Underlined Alert!', 2000)"> Underlined Alert box!! </a> <br> <br>
</body>
</html>
登录后复制

On clicking bold and rounded alert box button, a rounded shaped alert box with bold text will be displayed on the screen. On clicking the emphasized alert box button, a rectangular alert box with emphasized text will be displayed. Whereas on clicking underlined alert box, rectangular alert box with underlined text will be displayed.

Conclusion

在本文中,我们使用Materialize CSS来创建对话框。我们学习了Materialize toast()函数,它使我们能够创建自定义的提示框。我们还学习了一些JavaScript概念,比如onclick()函数。

以上是解释 Materialise CSS 中的对话框的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
4 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

使用GraphQL缓存 使用GraphQL缓存 Mar 19, 2025 am 09:36 AM

如果您最近开始使用GraphQL或审查了其优点和缺点,那么您毫无疑问听到了诸如“ GraphQl不支持缓存”或

使您的第一个自定义苗条过渡 使您的第一个自定义苗条过渡 Mar 15, 2025 am 11:08 AM

Svelte Transition API提供了一种使组件输入或离开文档(包括自定义Svelte Transitions)时动画组件的方法。

展示,不要说 展示,不要说 Mar 16, 2025 am 11:49 AM

您花多少时间为网站设计内容演示文稿?当您撰写新的博客文章或创建新页面时,您是在考虑

使用Redwood.js和Fauna构建以太坊应用 使用Redwood.js和Fauna构建以太坊应用 Mar 28, 2025 am 09:18 AM

随着最近比特币价格超过20k美元的攀升,最近打破了3万美元,我认为值得深入研究创建以太坊

NPM命令是什么? NPM命令是什么? Mar 15, 2025 am 11:36 AM

NPM命令为您运行各种任务,无论是一次性或连续运行的过程,例如启动服务器或编译代码。

您如何使用CSS创建文本效果,例如文本阴影和渐变? 您如何使用CSS创建文本效果,例如文本阴影和渐变? Mar 14, 2025 am 11:10 AM

文章讨论了使用CSS来获得阴影和渐变等文本效果,优化它们以进行性能并增强用户体验。它还列出了初学者的资源。(159个字符)

用高架创建自己的野蛮人 用高架创建自己的野蛮人 Mar 18, 2025 am 11:23 AM

无论您是开发人员的哪个阶段,我们完成的任务(无论大小)都会对我们的个人和专业成长产生巨大影响。

让我们使用(x,x,x,x)来谈论特殊性 让我们使用(x,x,x,x)来谈论特殊性 Mar 24, 2025 am 10:37 AM

前几天我只是和埃里克·迈耶(Eric Meyer)聊天,我想起了我成长时代的埃里克·迈耶(Eric Meyer)的故事。我写了一篇有关CSS特异性的博客文章,以及

See all articles