DescriptionSB Admin 2 is a free, open source, Bootstrap 4 based admin theme perfect for quickly creating dashboards and web applications. It's modern design style with subtle shadows and a card-based layout could be described as flat material, and is inspired by the principles of material design along with a simple, attractive color system. Show
Features
IntroductionModern CSS is a powerful tool you can use to create many advanced User Interface (UI) features. In the past, these features relied on JavaScript libraries. In this guide, you will set up a few CSS lines to create a scrolling parallax effect on a web page. You will use images from You will have a webpage with a pure CSS scrolling parallax effect once you’ve completed the tutorial. Warning: This article uses experimental CSS properties that do not work across browsers. This project has been tested and works on Chrome. This technique doesn’t work well in Firefox, Safari, and iOS due to some of those browsers’ optimizations. Step 1 — Creating a New ProjectIn this step, use the command line to set up a new project folder and files. To start, open your terminal and create a new project folder. Type the following command to create the project folder:
In this case, you called the folder
Next, create an
You will put all the HTML for the project in this file. In the next step, you will start creating the structure of the webpage. Step 2 — Setting Up the Application StructureIn this step, you will add the HTML needed to create the structure of the project. Inside your css-parallax/index.html
This is the basic structure of most webpages that use Add the following code inside the
This code creates three different sections. Two will have a background image, and one will be a static, plain background. In the next
few steps, you will add the styles for each section using the classes you added in the Step 3 — Creating a CSS File and Adding Initial CSSIn this step, you will create a First, create a
This is where you will put all of the CSS needed to create the parallax scrolling effect. Next, start with the
The The height of the wrapper needs to be set to a fixed value for the effect to work. You can use the viewport unit When you scale the images, they will add a horizontal
scrollbar to the screen, so you can disable it by adding In the next step, you will add more CSS to style your webpage. Step 4 — Adding Styles for the .section ClassIn this step, you will add styles to the Inside your css-parallax/styles.css
The Set a position of Each section has a Finally, the remainder Next, you will add a pseudo-element and style it to create the parallax effect on two of the sections in your Step 5 — Adding Styles for the .parallax ClassIn this step, you will add the styles to the First, you will add a pseudo-element
on the Note: You can visit MDN web docs to learn more about CSS pseudo-elements. Add the following code below the css-parallax/styles.css
The The pseudo-element is the last
child of the element with the class The first half of the code displays and positions the psuedo-element. The Because the pseudo-element is further away, it appears to move more slowly. In the next step, you will add in the background images and static background style. Step 6 — Adding the Images and Background For Each SectionIn this step, you will add the final First, add a solid background color to the css-parallax/styles.css
The The two sections with the Add the following code to the css-parallax/styles.css
The The images are from the placekitten website. It is a service for getting pictures of kittens for use as placeholders. Now that all of the code for
the parallax scrolling effect is added, you can link to your Step 7 — Linking styles.css and Opening index.html in Your BrowserIn this step, you will link your First, add the following code to the
Now, you can open your With that, you have set up a functioning webpage with a scrolling effect. Check out this GitHub repository to see the full code. ConclusionIn this article, you set up a project with an It’s possible to put the images you use or the parallax effect further away so that they move more slowly. You’ll have to change the pixel amount on Bagaimana cara memanggil CSS pada HTML?Untuk memasukkan CSS ke dalam file HTML kita akan memakai tag <link rel="stylesheet" href="path_ke_css_file" /> . Jika sedang membuat project web yang besar, sebaiknya menggunakan mode external CSS karena akan jauh lebih mudah untuk maintenance dan juga efisiensi size CSS.
Apa itu CSS selector dan contohnya?CSS selector adalah salah satu rule set dari Css yang fungsinya tidak berbeda jauh dengan namanya (Selector) yakni memilih suatu elemen yang ingin anda beri gaya atau style css. Universal selector berarti memilih semua elemen yang ada pada suatu halaman HTML.
Berapa selector CSS?Ada 6 macam selektor di CSS:. Selektor Tag.. Selektor Class.. Selektor ID.. Selektor Atribut.. Selektor Universal.. Selektor Pseudo.. Apa yang dimaksud dengan selector CSS?CSS selector adalah salah satu rangkaian aturan dari CSS yang memiliki fungsi untuk memilih suatu elemen yang ingin kamu beri gaya.
|