简体   繁体   English

如何制作横幅图片?

[英]How to Make a Banner Image?

I have started developing my first website.我已经开始开发我的第一个网站。 I have run into an issue though - I can't figure out how to make a "Banner Image"!不过我遇到了一个问题 - 我不知道如何制作“横幅图像”!

Here is an example of what I'm trying to achieve:这是我要实现的目标的示例:在此处输入图片说明 Since I am a beginner in CSS, how would I make a simple version of this?由于我是 CSS 的初学者,我将如何制作一个简单的版本?

There are two ways using which you can create a banner image, the easy way and the not-so-difficult way.有两种方法可以创建横幅图像,简单的方法和不太困难的方法。

The Easy Way:简单的方法:

Create a banner image using an image editing software like Photoshop and then use that image as a background-image on a <div> .使用图像编辑软件(如 Photoshop)创建横幅图像,然后将该图像用作<div>上的background-image Like this:像这样:

 #bannerimage { width: 100%; background-image: url(http://s30.postimg.org/x0ne0p5wx/bootsrap.png); height: 405px; background-color: purple; background-position: center; }
 <div id="bannerimage"></div>

The Not-So-Difficult Way:不太难的方法:

You will need to convert the banner design into HTML and style it using CSS.您需要将横幅设计转换为 HTML 并使用 CSS 为其设置样式。 For example, let's take into account that purple bootstrap banner.例如,让我们考虑紫色引导横幅。 It has a large purple background and all the text is added on it and then styled using CSS.它有一个大的紫色背景,所有的文本都添加在上面,然后使用 CSS 设置样式。 You can do that like this:你可以这样做:

 #header { background: #664c8f; height: auto; padding: 100px 100px } h1 { color: white; font-family: Arial; text-align: center; } a#download { display: block; text-align: center; width: 150px; margin: 0px auto; padding: 20px; color: white; text-transform: uppercase; font-family: Arial; border: 1px solid #fff; text-decoration: none; border-radius: 10px; }
 <div id="header"> <h1>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.</h1><a href="#" id="download">Download</a> </div>

I hope this helps.我希望这有帮助。

 #bannerimage { width: 100%; background-image: url(http://s30.postimg.org/x0ne0p5wx/bootsrap.png); height: 405px; background-color: purple; background-position: center; }
 <div id="bannerimage"></div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM