That will trigger a horizontal scrollbar, which is almost always undesirable. The problem occurs when the browser window is narrower than the specific width of the wrapper. Therefore, the wrapper element will take up the specified width. Setting the width of a block-level element will prevent it from stretching out to the edges of its container (good for things like readable line lengths). Here’s an example of a general page wrapper: /** Naming conventions make our code more readable and predictable. But remember, naming is one of the most fundamental and important parts of developer activities. There might be other conventions too, so the best advice is usually to implement whatever makes the most sense to you. The terms wrapper and container can also mean the same thing depending on the developer and what they intend. As an example, Bootstrap has “ container classes” that house their grid system or contain various other components. It serves the purpose of grouping elements both semantically and visually. One that sometimes necessary to implement a behavior or styling of multiple components. The container, on the other hand, usually intends another kind of containment. Wrappers are also used for things like applying a sticky footer. I’m sure many of us have lived through a time where we set that to 960px in width and center aligned all our main content. Speaking of the wrapper, it’s common to think of a that contains all the rest of the HTML of the document. So, in my opinion, it makes sense to have two different names because they intend different functions. A wrapper, on the other hand, is something that wraps around a single object to provide more functionality and interface to it. In programming languages, the word container is generally used for structures that can contain more than one element. I believe there is a difference between wrapper and container elements. I found a related thread on StackOverflow that has more than 250,000 views, so obviously I’m not the only one wondering! I’ll sum up my latest thoughts in this article.īefore we dive into it, let’s first examine the difference between the “wrapper” and the “container”. I’ve always struggled to with the best way to implement it. We give it a class, and that class is responsible for encapsulating all visual elements on the page. Sometimes the first bit of HTML we write in a new document is an element that wraps everything else on the page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |