I’ve seen a lot of introductions to CSS frameworks recently. I said something a few days ago: “In my limited field of vision, I haven’t seen anything that can truly be called a CSS framework~”, of course it could be me. My field of vision is too small, or the world is too big. I still feel that there are a lot of things that I cannot see.
Let’s first look at a concept that I agree with:
Frameworks can be divided into two frameworks: White-Box and Black-Box.
Frameworks based on inheritance are called white-box frameworks. The so-called white box has visibility, and the internal implementation details of the inherited parent class are known to the subclass. Application developers who utilize white-box frameworks develop systems by deriving subclasses or overriding member methods of parent classes. The implementation of a subclass depends heavily on the implementation of the parent class, and this dependency limits the flexibility and completeness of reuse. But the way to solve this limitation can be to only inherit the abstract parent class, because abstract classes basically do not provide concrete implementation. The white-box framework is a program skeleton, and user-derived subclasses are accessories to this skeleton.
The framework based on object component assembly is a black box framework. Application developers obtain system implementation by sorting and assembling objects. Users only need to understand the external interface of the component and do not need to understand the specific internal implementation. In addition, assembly is more flexible than inheritance and can be changed dynamically. Inheritance is only a static compile-time concept.
In an ideal situation, any required functionality can be obtained by assembling existing components. In fact, the available components are far from meeting the needs. Sometimes it is more efficient to obtain new components through inheritance than to assemble new components using existing components. Easy, so white box and black box will be used in the development of the system at the same time. However, white box frameworks tend to develop towards black box frameworks, and black box frameworks are also the ideal goals that system development hopes to achieve.
Look back at the many CSS frameworks on the Internet today (YUI is called "YUI Library CSS Tools" and not "YUI CSS Frameworks"). How many of them are actually written with the concept of a framework, and how many of them just define style base classes? . Of course, everyone’s understanding of the framework may not be the same, and you may not agree with what I say.
Let’s talk about the CSS framework again. It’s not that I don’t recognize the existence of this thing. I have been trying such things since a year or two ago. For large websites, front-end development requires a solution. The framework is naturally the first choice. It's a pity that it's too far away from me, I'm too weak T_T, I only need two points:
Something to manage the following content
Class/component
Obviously, the first point cannot be done by CSS, and the second point, compared to other things The language is very weak.
When I was working on a medium-sized website about a year ago, to be lazy, I thought of modularizing the content and letting programmers put together pages. The general direction is to encapsulate one functional block after another. Programmers only need to use the corresponding HTML and CSS when they want to use which piece of content. It is convenient for everyone. I don’t need to spell the page. He doesn’t need to repeat the code. Hello everyone. It's really good.
It is normal for similar content blocks to be used multiple times on the same website. This also makes modularization possible, such as a picture list, perhaps a list of user avatars, or a list of group icons. How would you write it? Is the same used like this?
.photoListUesr,.photoListGroup{ /*_*/ }
This doesn’t mean it’s not possible, but what if you suddenly want to add a similar one? You may need to adjust the style at this time. and I? We have tried using it this way:
In this case, we separate out the common expressions from the beginning, use .photoList as the prototype, and handle the details through additional classes. A few days ago, I wrote about object-oriented XHTML and CSS programming. In fact, I only wrote half of it. The other half was detailed examples, but I didn’t finish it because I had to do too many examples and the core was already written. ^^ Of course , this also has certain problems, that is, the definition of the initial prototype must be very careful, and try to ensure that even if it is revised in the future, it may not need to be modified. With CSS, basically a framework can only fit one website at most. Of course, if the website is large enough, it makes sense to use it this way.
The more modular HTML and CSS become, the more dispersed the files become, and the more serious this problem becomes. HTML is easy to handle, since the application will eventually merge and output one copy, but CSS is usually discarded and used directly. If in the example just now, the way to import CSS into the web page is like this:
@import url(/xxx/photoList.css);
@import url(/xxx/UserCt.css);
@import url(/ xxx/GroupCt.css);
You can even consider using a program to combine pages, but it is easy to use and proportional to the number of requests. Generally, everyone will choose to merge files manually. Although the human brain is more intelligent than a computer, in many cases the computing power of the human brain is not as good as that of a computer. I once had the idea of using a server-side program to handle the CSS release mechanism. The general direction is to analyze the usage of various pages of the entire site through website access logs, and use the program to calculate which public uses need to be merged. The order (the order of CSS files will affect the priority), etc. Various calculations and compressed output.
Unfortunately, such a complex program may only be suitable for one website, or a group of websites in the same series. Although it is a bit troublesome to do, I believe it is necessary to use this method for portal-level websites. Of course, the premise is that the entire team must use the same design pattern.
PS: The above CSS publishing program is just my fantasy. I haven’t tried it yet. Interested friends can try it. If there are any accidents, we will not be responsible.
Of course, the above cannot be called CSS Frameworks, perhaps it can only be called a system-level solution. After all, CSS is just a descriptive language.
When Yueying and I were having roast duck last night, we talked about this and he asked me if I had an integrated front-end solution. The same problem will be faced when JS is componentized, and similar publishing mechanisms should also be applicable to JS. But I haven’t thought of a completely integrated solution yet. Maybe Yueying will treat me to roast duck a few more times and I can figure it out.
The above is the discussion about the CSS framework. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!

@keyframesandCSSTransitionsdifferincomplexity:@keyframesallowsfordetailedanimationsequences,whileCSSTransitionshandlesimplestatechanges.UseCSSTransitionsforhovereffectslikebuttoncolorchanges,and@keyframesforintricateanimationslikerotatingspinners.

I know, I know: there are a ton of content management system options available, and while I've tested several, none have really been the one, y'know? Weird pricing models, difficult customization, some even end up becoming a whole &

Linking CSS files to HTML can be achieved by using elements in part of HTML. 1) Use tags to link local CSS files. 2) Multiple CSS files can be implemented by adding multiple tags. 3) External CSS files use absolute URL links, such as. 4) Ensure the correct use of file paths and CSS file loading order, and optimize performance can use CSS preprocessor to merge files.

Choosing Flexbox or Grid depends on the layout requirements: 1) Flexbox is suitable for one-dimensional layouts, such as navigation bar; 2) Grid is suitable for two-dimensional layouts, such as magazine layouts. The two can be used in the project to improve the layout effect.

The best way to include CSS files is to use tags to introduce external CSS files in the HTML part. 1. Use tags to introduce external CSS files, such as. 2. For small adjustments, inline CSS can be used, but should be used with caution. 3. Large projects can use CSS preprocessors such as Sass or Less to import other CSS files through @import. 4. For performance, CSS files should be merged and CDN should be used, and compressed using tools such as CSSNano.

Yes,youshouldlearnbothFlexboxandGrid.1)Flexboxisidealforone-dimensional,flexiblelayoutslikenavigationmenus.2)Gridexcelsintwo-dimensional,complexdesignssuchasmagazinelayouts.3)Combiningbothenhanceslayoutflexibilityandresponsiveness,allowingforstructur

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
