
CSS Patterns
文章平均质量分 69
kaqi072821
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Wrap the line in pre
Problem: The <pre> tag of html is used to keep the format of the content as it is inputted. So, if the content is a long line of text with no line break, then it will displayed as one line an...原创 2012-02-10 17:31:41 · 101 阅读 · 0 评论 -
Simple switch themes
Problems: Two pages have similar elements structure but with different style themes. Or in the same page, we want to apply different style according to the user's preference. Solution: One ...原创 2012-03-27 20:53:06 · 152 阅读 · 0 评论 -
Pull common style up
Problems : For the common style. we would like to let it applied as far as possible instead of add a the style for each child element. Try it with jsfiddle原创 2012-03-27 20:52:02 · 103 阅读 · 0 评论 -
Element With Attachment
Problems: Some elements has an attachment element. This attachment can show and hide. When it is shown, it should be on the top But it won't affect the position of the elements afterwards. For ex...原创 2012-03-15 22:03:25 · 110 阅读 · 0 评论 -
Navigation with ul and li
Problems: We need a navigation on most of the web pages. We can use <ul> and <li> to set the items of the navigation. There are many navigation style. Here, I just give an example to sh...原创 2012-03-15 21:15:19 · 130 阅读 · 0 评论 -
Clear floated elements
Problems: Floated elements would keep align one after another. There are two situations that we may need to clear floated element. 1. We need to clear the previous floated elements and start fro...原创 2012-03-14 21:34:26 · 117 阅读 · 0 评论 -
Columns With Relative Width
Problem: Suppose we need to display a datalist in two columns, each column fills one half of the width, with a fixed pixels of margin between the two columns though. Because it is a datalist, we w...原创 2012-03-12 22:00:35 · 117 阅读 · 0 评论 -
Blocked Wrapper
Problem: We have a container element with % to define the width. In the container, we need to display another element that fullfills this container. The conained element need some border or padding...原创 2012-03-12 21:44:47 · 91 阅读 · 0 评论 -
Required red star
Problem: We usually put a red star after a field to indicate that this field is required. Of course, we can add a '*' and apply css on it. But it is really unconvenient to do so on everywhere. F...原创 2012-03-11 18:05:19 · 130 阅读 · 0 评论 -
Overlapped Margins
Problem: The vertically neighbouring margins will be merged if they are not seperated by border or padding. The final margin pixels is the biggest one among them. This is a feature of css that we...原创 2012-03-11 15:07:30 · 115 阅读 · 0 评论 -
Padding Images With Background Image
Problems: We want to display something like this. The container has an image arrow on the right. The content text length is undetermined. Solution: We can resort to background to display ...原创 2012-03-10 21:33:30 · 113 阅读 · 0 评论 -
Full Screen Page Width
The page does not has a fixed width, but fills all the screen of the browser, no matter what the current browser display resolution is. The contents of the page also does not has a fixed width eithe...原创 2012-03-09 12:02:00 · 152 阅读 · 0 评论 -
Fixed Pixels Page Width
The whole page displays with a fixed width of pixels. It does not consider the resolution of the screen and the browser's display resolution. A example of this pattern would be http://www.apple.com/s...原创 2012-03-09 10:28:28 · 105 阅读 · 0 评论 -
CSS Reset
Purpose: To dismiss problems that may be caused by browsers’ default style. We use a css script to override the default style, so that they will behave all the same in different kind of browse...原创 2012-03-07 22:14:30 · 99 阅读 · 0 评论 -
Vertically Centering With Line-Height
Problems: We want to keep the content displayed center vertically in one container(div, a, p, span etc). The contents' height is less than the container's height. height: 28px; font-size...原创 2012-02-26 17:58:57 · 104 阅读 · 0 评论 -
Padding Images With Absolute Position
Problems: We want to display something like this. The container has images on the left and right, with absolute position. The contents text is in the middle. Solution: We have an <a>...原创 2012-02-18 22:26:29 · 133 阅读 · 0 评论 -
Horizontally centering with "margin auto"
Problems: We want to keep the content displayed center horizontally in one container(div, p etc). Solution: We can use auto margin to center the element like below. <div id="con...原创 2012-02-13 22:32:39 · 107 阅读 · 0 评论 -
Link up background image
TBD原创 2012-03-27 20:55:15 · 100 阅读 · 0 评论