This article was peer reviewed by Ralph Mason, Giulio Mainardi, and Mikhail Romanov. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be!
本文由Ralph Mason , Giulio Mainardi和Mikhail Romanov进行了同行评审。 感谢所有SitePoint的同行评审人员使SitePoint内容达到最佳状态!
Presentations are one of the best ways to serve information to an audience. The format is short and sharp, made up of small, digestible chunks, which makes any topic under discussion engaging and easier to understand. A presentation can contain all kinds of data, represented by many different elements, such as tables, charts, diagrams, illustrations, images, videos, sounds, maps, lists, etc, all of which lends great flexibility to this medium of expression.
演示是向观众提供信息的最佳方法之一。 该格式简短明了,由可消化的小块组成,这使得正在讨论的任何主题都引人入胜且易于理解。 演示文稿可以包含由许多不同元素表示的各种数据,例如表格,图表,图表,插图,图像,视频,声音,地图,列表等,所有这些都为这种表达媒介提供了极大的灵活性。
Particularly on the web, presentations come in handy on many occasions, and there are loads of tools at your disposal to create some nifty ones. Today, I’ll introduce you to WebSlides — a small and compact library with a nice set of ready-to-use components, which you can leverage to build well-crafted and attractive web presentations:
尤其是在网络上,演示文稿在很多情况下都派上用场,并且您可以使用许多工具来创建漂亮的工具。 今天,我将向您介绍WebSlides-一个小型紧凑的库,其中包含一组很好的即用型组件,您可以利用它们来构建精心制作且引人入胜的Web演示文稿:
WebSlides “is about telling the story, and sharing it in a beautiful way.”
WebSlides“是讲故事,并以优美的方式分享。”
In fact, one of WebSlides’ main benefits is that you can share your story beautifully and in a variety of different ways. With one and the same architecture — 40+ components with semantic classes, and clean and scalable code — you can create portfolios, landings, longforms, interviews, etc.
实际上,WebSlides的主要优点之一就是您可以通过各种不同方式精美地分享您的故事。 使用一个和一个相同的体系结构-40多个带有语义类的组件以及干净且可扩展的代码-您可以创建项目组合,登录,长格式,访谈等。
Besides, you can also extend WebSlides’ functionality by combining it with third-party services and tools such as Unsplash, Animate.css, Animate On Scroll, and so on.
此外,您还可以通过将WebSlides与第三方服务和工具(如Unsplash , Animate.css , Animate On Scroll等)结合使用来扩展其功能。
WebSlides is easy to learn and fun to use. Let’s see it in action now.
WebSlides易于学习且易于使用。 让我们现在来看一下它。
To get started, first download WebSlides. Then, in the root folder, create a new folder and call it presentation
. Inside the newly created presentation
folder, create a new file and call it index.html
. Now, enter the following code, which contains the needed references to the WebSlides’ files (make sure the filepaths correspond to the folder structure in your setup):
首先,请首先下载WebSlides 。 然后,在根文件夹中,创建一个新文件夹,并将其命名为presentation
。 在新创建的presentation
文件夹中,创建一个新文件,并将其命名为index.html
。 现在,输入以下代码,其中包含对WebSlides文件的所需引用(确保文件路径与您的设置中的文件夹结构相对应):
Now, you’re ready to go.
现在,您准备好了。
In this section you’re going to create a short, but complete presentation, which explains why SVG is the future of web graphics. Note: If you are interested in SVG, please check my articles: SVG 101: What is SVG? and How to Optimize and Export SVGs in Adobe Illustrator.
在本节中,您将创建一个简短但完整的演示文稿,它解释了为什么SVG是Web图形的未来。 注意:如果您对SVG感兴趣,请查看我的文章: SVG 101:什么是SVG? 以及如何在Adobe Illustrator中优化和导出SVG 。
You’ll be working step by step on each slide. Let’s get started with the first one.
您将在每张幻灯片上逐步进行操作。 让我们从第一个开始。
The first slide is pretty simple. It contains only one sentence:
第一张幻灯片非常简单。 它仅包含一个句子:
Why SVG Is the Future of Web Graphics?
...
...
Each parent inside
creates an individual slide. Here, you’ve used two classes from WebSlides’ arsenal, i.e.,
bg-gradient-r
and aligncenter
, to apply a radial gradient background and to align the slide content to the center respectively.
每个父
创建一个单独的幻灯片。 在这里,您已经使用了WebSlides的军械库中的两个类,即
bg-gradient-r
和aligncenter
,以应用径向渐变背景并将幻灯片内容分别与中心对齐。
The second slide explains what SVG is:
第二张幻灯片解释了SVG是什么:
What Is SVG?
Scalable Vector Graphics
SVG is an XML-based vector graphic format used to display a wide range of graphics on the Web.
SVG documents are just plain text files and can be created and edited in every text editor.
The code above uses the content-left
and content-right
classes to separate the content into two columns. Also, in order to make the above classes work, you need to wrap all content by using the wrap
class. On the left side, the code uses text-subtitle
to make the text all caps, and text-intro
to increase the font size. The right side consists of an illustrative image.
上面的代码使用content-left
和content-right
类将内容分为两列。 另外,为了使上述类起作用,您需要使用wrap
类包装所有内容。 在左侧,代码使用text-subtitle
来使文本全部大写,并使用text-intro
来增加字体大小。 右侧包括一个说明性图像。
The next slide uses the grid component to create two columns:
下一张幻灯片使用网格组件创建两列:
SVG Is Future-Proof
As long as the W3C sets the global industry standards, it seems that SVG will continue to be the de-facto standard for vector graphics in the browser.
SVG is a W3C standard. This makes SVG future-proof. Technologies are rapidly changing. What's here today could be gone tomorrow. But SVG will most likely be around for a long time.
The snippet above shows how to use the grid
and column
classes to create a grid with two columns. In the first column the style
attribute aligns the text to the left (Note how the aligncenter
class on the element cascades through to its
.column
child element, which causes all text inside the slide to be center aligned). In the second column, the browser
class makes the illustrative image look like a screenshot.
上面的代码段显示了如何使用grid
和column
类创建具有两列的网格。 在第一列中, style
属性将文本向左对齐(请注意元素上的
aligncenter
类如何级联到其.column
子元素,这将使幻灯片内的所有文本居中对齐)。 在第二列中, browser
类使说明性图像看起来像屏幕截图。
In the fourth slide, use the grid component again to split the content into two columns:
在第四张幻灯片中,再次使用网格组件将内容分为两列:
SVG Is the Best Graphic Format for the Web
What makes SVG so preferable for the Web is its remarkable usefulness and unlimited flexibility. It's the only one graphic format which most closely and completely responds to the current web development demands such as scalability, responsibility, interactivity, programmability, and accessibility.
As a graphic format SVG perfectly suits the needs of the web because it satisfies both designers and developers. An illustration can be easily created by a designer with any vector software, and then, the exported SVG can be transferred to a developer who can add animation or some other interactivity.
In this slide, place half of the content to the left and the other half to the right using the content-left
and content-right
classes respectively:
在此幻灯片中,分别使用content-left
和content-right
类将content-left
一半放在左侧,将另一半放在右侧:
SVG Usage Is Growing
Over the last year SVG usage has doubled.
As of 2014 SVG usage is growing continuously (image below) and it has doubled over the last year (right image).
In this slide, use the 在此幻灯片中,使用 In this slide, put the explanation text on the left and the illustrative image on the right at 40% of its default size (with the 在此幻灯片中,将说明文字放在其默认大小的40%的左侧,并将说明性图像放在右侧(在 Do a similar thing here: 在这里做类似的事情: This slide also uses a similar structure: 该幻灯片也使用类似的结构: Here, divide the content into left and right again. In the second 在这里,将内容再次分为左右。 在第二个 Here, leverage some of the classes you’ve already used to illustrate browser support for SVG: 在这里,利用一些您已经用来说明浏览器对SVG的支持的类: The browser support for SVG is 97% and above In this slide, show some of the use cases for SVG in the form of an image gallery. To this end, use an unordered list with the 在此幻灯片中,以图片库的形式展示SVG的一些用例。 为此,请对 This section shows a typical SVG workflow, so you need to use the 本节显示了典型的SVG工作流程,因此您需要使用 Draw your graphic in a vector editing program such as Adobe Illustrator Export the drawing as an SVG file For each step after the first one, you need to add the 对于第一个步骤之后的每个步骤,您需要添加 In the last slide, use another one of WebSlides’ built-in CSS animations, i.e., 在最后一张幻灯片,使用WebSlides内置CSS动画,即,另一个 Congratulations! You’re done. You can see the final outcome here: 恭喜你! 你完成了。 您可以在此处查看最终结果: See the Pen HTML and CSS Presentation Demo with WebSlides by SitePoint (@SitePoint) on CodePen. 请参阅CodePen上带有 SitePoint( @SitePoint )的WebSlides的Pen HTML和CSS演示 示例 。 Et voilà! You have just created a beautiful, fully functional and responsive web presentation. But this is just the tip of the iceberg, there’s a lot more you can quickly create with WebSlides and many other WebSlides features which I didn’t cover in this short tutorial. 等等! 您刚刚创建了一个美观,功能齐全且响应Swift的Web演示文稿。 但这只是冰山一角,使用WebSlides和许多其他WebSlides功能可以快速创建更多功能,而我在本简短教程中没有介绍。 To learn more, explore the WebSlides Components and CSS architecture documentation, or start customizing the demos already available to you in the downloadable folder. 要了解更多信息,请浏览WebSlides组件和CSS体系结构文档 ,或开始自定义可下载文件夹中已经可用的演示。 Then, focus on your content and let WebSlides do its job. 然后,专注于您的内容,并让WebSlides完成其工作。 翻译自: https://www.sitepoint.com/how-to-create-beautiful-html-css-presentations-with-webslides/background
class to embed an image as a background with the Unsplash service. Put the headline on light, transparent background by using the bg-trans-light
class. The text’s color appears white, because the slide uses a black background with the bg-black
class, therefore the default color is inversed, i.e., white on black rather than black on white. Also, for the text to be visible in front of the image, wrap it with background
类通过Unsplash服务将图像嵌入为背景。 使用bg-trans-light
类,将标题放在浅色透明背景上。 文本的颜色显示为白色,因为幻灯片使用bg-black
类为黑色的背景,因此默认颜色是相反的,即黑色为白色而不是黑色为白色。 另外,为了使文本在图像前面可见,请用SVG Solves the Most Important Problems in Modern Web Development
投影片7 (Slide 7)
alignright
and size-40
classes on the element). For this and the next three slides, use
slideInRight
, which is one of WebSlides’ built-in CSS animations:元素上使用
alignright
和size-40
类)。 对于本幻灯片和接下来的三张幻灯片,请使用slideInRight
,它是WebSlides的内置CSS动画之一: 投影片8 (Slide 8)
投影片9 (Slide 9)
投影片10 (Slide 10)
tag, use the inline
style
attribute to adjust the font-size
and line-height
properties. Doing so will override the text-intro
class styles that get applied to the element by default. On the right side, use 标记中,使用内联
style
属性调整font-size
和line-height
属性。 这样做将覆盖默认情况下应用于该元素的text-intro
类样式。 在右侧,使用 投影片11 (Slide 11)
SVG Has Very Good Browser Support
投影片12 (Slide 12)
flexblock
and gallery
classes. Each item in the gallery is marked up with a li
tag:flexblock
和gallery
类使用无序列表。 画廊中的每个物品都标有li
标签: SVG Has Many Different Use Cases
投影片13 (Slide 13)
flexblock
and steps
classes, which show the content as a sequence of steps. Again, each step is placed inside a li
tag:flexblock
和steps
类,它们将内容显示为一系列步骤。 同样,每个步骤都放在li
标签内: The SVG Workflow Is Straightforward
01. Draw
02. Export
process-step-#
class. This adds a triangle pointing to the next step.process-step-#
类。 这将添加一个三角形,指向下一步。 投影片14 (Slide 14)
zoomIn
:zoomIn
: Start Coding SVG Today!
结论 (Conclusion)