- Bootstrap 4 Cookbook
- Ajdin Imsirovic
- 369字
- 2021-07-02 21:08:07
How it works...
There are a lot of things happening in this recipe. In step 1, we add the recipe-specific HTML structure. To achieve the desired effect, we are using Bootstrap 4's media object. The structure is pretty easy to grasp, so we will not delve into details here. For some basic examples, refer to https://v4-alpha.getbootstrap.com/layout/media-object/.
Part of the HTML structure worth mentioning is the <img> tag, which calls the placehold.it as its source, with the custom size, background color, and text (the play symbol) passed to the src attribute as parameters.
We also use a paragraph with the class of lead to make the names more prominent, followed with the span with the float-right Bootstrap class. The three icons on the right use of Font Awesome styles, and we are adding our own custom color class of text-faded-green. A similar custom color background class is used on Bootstrap's badge class, which is added to the HTML's <time> element.
The lower half of the HTML structure is a made-up comment by Jane Doe, as a response to the notification posted by John Doe. Contrary to John Doe's icons, Jane Doe's icons are clickable, and clicking on any of the three icons (like Twitter or Facebook) will make custom alerts pop up underneath.
All of these css customizations are done in step 2. We can note that the *-faded-green class declarations dominate the top half of the style sheet. The custom-media class significantly changes the behavior of the media object by removing the left padding, thereby allowing it to take up more space, which is really important on smaller screens.
Finally, alert-twitter and alert-facebook are the added custom alert classes. The like button uses the regular alert-success class.
In step 3, we include the custom css, and in step 4, we make a smooth appearance of the alert boxes possible, triggered by clicking on the icons. The code is a bit clunky, and it is possible to improve it. However, just as it is, it is a great example of what is happening on each click and how all the parts come together. Since this example is already pretty advanced, we will not deal with refactoring of the jQuery code.
- 零基礎(chǔ)搭建量化投資系統(tǒng):以Python為工具
- Offer來(lái)了:Java面試核心知識(shí)點(diǎn)精講(原理篇)
- Learning ASP.NET Core 2.0
- Groovy for Domain:specific Languages(Second Edition)
- WebRTC技術(shù)詳解:從0到1構(gòu)建多人視頻會(huì)議系統(tǒng)
- Arduino家居安全系統(tǒng)構(gòu)建實(shí)戰(zhàn)
- PHP編程基礎(chǔ)與實(shí)例教程
- 從零開(kāi)始學(xué)Linux編程
- C語(yǔ)言開(kāi)發(fā)基礎(chǔ)教程(Dev-C++)(第2版)
- Advanced Express Web Application Development
- INSTANT Yii 1.1 Application Development Starter
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)教程(Windows 7+Office 2010)
- Python 3 數(shù)據(jù)分析與機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- Python自然語(yǔ)言理解:自然語(yǔ)言理解系統(tǒng)開(kāi)發(fā)與應(yīng)用實(shí)戰(zhàn)
- Fastdata Processing with Spark