A cool-looking box - Learn web development 编辑

In this assessment, you'll get some more practice in creating cool-looking boxes by trying to create an eye-catching box.

Prerequisites:Before attempting this assessment, you should have already worked through all the articles in this module.
Objective:To test comprehension of the CSS box model and other box-related features such as borders and backgrounds.

Starting point

To get this assessment started, you should:

  • Make local copies of the starting HTML and CSS — save them as index.html and style.css in a new directory.

Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <style> element in the head of the document.

Note: If you get stuck, then ask us for help — see the Assessment or further help section at the bottom of this page.

Project brief

Your task is to create a cool, fancy box and explore the fun we can have with CSS.

General tasks

  • Apply the CSS to the HTML.

Styling the box

We'd like you to style the provided <p>, giving it the following:

  • A reasonable width for a large button, say around 200 pixels.
  • A reasonable height for a large button, centering the text vertically in the process.
  • Centered text.
  • A slight increase in font size, to around 17-18 pixel computed style. Use rems. Write a comment about how you worked out the value.
  • A base color for the design. Give the box this color as its background color.
  • The same color for the text; make it readable using a black text shadow.
  • A fairly subtle border radius.
  • A 1-pixel solid border with a color similar to the base color, but a slightly darker shade.
  • A linear semi-transparent black gradient that goes toward the bottom right corner. Make it completely transparent at the start, gradiating to around 0.2 opacity by 30% along, and remaining at the same color until the end.
  • Multiple box shadows. Give it one standard box shadow to make the box look slightly raised off the page. The other two should be inset box shadows — a semi-transparent white shadow near the top left and a semi-transparent black shadow near the bottom right — to add to the nice raised 3D look of the box.

Example

The following screenshot shows an example of what the finished design could look like:

Assessment or further help

If you would like your work assessed, or are stuck and want to ask for help:

  1. Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch.
  2. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include:
    • A descriptive title such as "Assessment wanted for Cool-looking box".
    • Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment.
    • A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code.
    • A link to the actual task or assessment page, so we can find the question you want help with.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:127 次

字数:5167

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文