Introduction
In this lab, we will explore the basics of CSS programming and learn how to use CSS to style and format web pages. Through a series of hands-on exercises, you will gain a solid understanding of CSS syntax, selectors, properties, and values, and be able to create visually appealing and responsive web pages. By the end of this lab, you will have a strong foundation in CSS and be ready to take on more advanced web development projects.
Polka Dot Background Pattern
index.html and style.css have already been provided in the VM.
To create a polka dot background pattern, you can follow these steps:
- Set the
background-colorproperty to black. - Use the
background-imageproperty with tworadial-gradient()values to create two dots. - Specify the pattern's size using the
background-sizeproperty. Usebackground-positionto appropriately place the two gradients. - Set
background-repeattorepeat. - Note that the fixed
heightandwidthof the element is for demonstration purposes only.
Here's an example HTML code for a div element with class polka-dot:
<div class="polka-dot"></div>
And here's the corresponding CSS code:
.polka-dot {
width: 240px;
height: 240px;
background-color: #000;
background-image:
radial-gradient(#fff 10%, transparent 11%),
radial-gradient(#fff 10%, transparent 11%);
background-size: 60px 60px;
background-position:
0 0,
30px 30px;
background-repeat: repeat;
}
Please click on 'Go Live' in the bottom right corner to run the web service on port 8080. Then, you can refresh the Web 8080 Tab to preview the web page.
Summary
Congratulations! You have completed the Polka Dot Background Pattern lab. You can practice more labs in LabEx to improve your skills.