惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
A
About on SuperTechFans
腾讯CDC
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google Online Security Blog
Google Online Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
爱范儿
爱范儿
D
DataBreaches.Net
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Proofpoint News Feed
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
S
SegmentFault 最新的问题
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
T
Tenable Blog
V
V2EX
M
MIT News - Artificial intelligence
Recorded Future
Recorded Future
A
Arctic Wolf
Hacker News - Newest:
Hacker News - Newest: "LLM"
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
L
LINUX DO - 热门话题
博客园 - 【当耐特】
博客园 - 叶小钗
S
Securelist
T
Tor Project blog
Forbes - Security
Forbes - Security
O
OpenAI News
IT之家
IT之家
博客园 - Franky

博客园 - 阿福

TypeScript forms authentication failed the ticket supplied was invalid错误 (Windows Server 2008 + IIS 7.5) jQuery Mobile 1.1.1 RC1发布 HashSet<T> vs List<T> 不要用把无序GUID既作为主键又作为聚集索引 WCF Data Services 5.0 RTM发布 EF Power Tools Beta 2发布 Entity Framework 5性能方面的注意事项 jQuery Mobile 1.1.0 RC2发布 源码+幻灯片:学习HTML5/jQuery/ASP.NET MVC/EF Code First的绝佳资源Account at a Glance项目 使用Autofac在ASP.NET Web API上实现依赖注入 在Windows Azure上开发ASP.NET程序与在Windows Sever上有何不同 充分利用缓存来提高网站性能 ASP.NET MVC 4, ASP.NET Web API, ASP.NET Web Pages v2 (Razor)全部开源,并接受来自社区的贡献(contributions) EF5 beta2通过NuGet发布 Getting Started with HTML5 开发HTML5应用你需要了解的 WCF入门资源 jquery history plugin, url hash Run Tasks in an ASP.NET Application Domain ASP.NET 2.0: 生成Excel报表 VS 2008 hot-fix终于出来了 Images; How to create an HTTP handler to dynamically resize images and change quality. ASP.NET 2.0: Add build-in paging feature to repeater/为repeater添加内置分页功能 Tip/Trick ASP.NET 2.0: DropDownList DataBind ASP.NET 2.0: Forms Authentication Across domains Ajax类库、框架、工具包完全列表 怀旧啊 Search Box ASP.NET 2.0: Site Maps Checking All CheckBoxes in a GridView Efficient Data Paging and Sorting with ASP.NET 2.0 and SQL 2005 JavaScript Calendar Cool MSDN ASP.NET 2.0 GridView Control Article Do I have to cry for you Google无法访问 扯淡 狗*! Atlas Control Toolkit and Source Code for the Build-in Asp.Net 2.0 Providers Great New Advanced Article on ASP.NET 2.0 Master Pages ASP.NET 2.0:通过SqlDataSource绑定数据到普通控件 通过客户端扩展实现固定GridView表头功能 不使用ISAPI或IIS wildcard实现不带扩展名URL的转向 VS 2005 Web Application Project & Atlas Control Toolkit & CSS Control Adapter ASP.NET 2.0 Language Swithcer and Theme Swicher 多语言转换和多样式主题转换 How to use virtual path providers to dynamically load and compile content from virtual paths in 
CSS: color style solution with css contexual selectors
阿福 · 2010-01-01 · via 博客园 - 阿福

Your web site always contains several modules which navigated by a menu or sth, just like this: forums | Blog | Photos. You may want each module has its own color style, so the users can recognize each module easily and your site also be cool. This article supplies a easier way to accomplish this aim by using the contexual selector feature of css.

1. What are contextual selectors of css?

Contextual selectors can look for element types, CLASS attributes, ID attributes or combinations of these:

DIV P           { font: small sans-serif }
.reddish H1     { color: red }
#x78y CODE      { background: blue }
DIV.sidenote H1 { font-size: large }

Reference to W3C

Of course, .class1 .class2 { .... }  is also a contexual selector, so is this .class1 .class2 .class3 {...}. We mainly use this style in this article.

2. Samples.

Suppose you got two pages: page1.htm and page2.htm. How can we define two color styles for the two page with minimus code typing?

Below is page1 and page2's html. (to be simple, I just list a few elements)

page1:

<body class=page1>

  <div class=primaryPalette> this is page1.</div>

</body>

page2:

<body class=page1>

  <div class=primaryPalette> this is page2.</div>

</body>

Define css classes in the css file and link it to your pages.

.page1 .primaryPalette{

 BORDER-LEFT-COLOR: #747e96; BORDER-BOTTOM-COLOR: #747e96; BORDER-TOP-COLOR: #747e96; BACKGROUND-COLOR: #747e96; BORDER-RIGHT-COLOR: #747e96

}

.page2 .primaryPalette{

 BORDER-LEFT-COLOR: #44a12c; BORDER-BOTTOM-COLOR: #44a12c; BORDER-TOP-COLOR: #44a12c; BACKGROUND-COLOR: #44a12c; BORDER-RIGHT-COLOR: #44a12c

}

By doing this, you got two pages with different colors. This is just a simple sample. Actually you can define as complex styles as you can, just in this format: <[.page1|. page2[|...] ]  [other classes inner]>. For example:

.page1 .a1 .b1 {}

.page2 .a1 .b1 {}

In the html of your pages, you just add or change the body's css class, then you can get a new color style of your page.

The idea of this article came from www.salesforce.com. You can check the source html and css of this web site and get the details.