嗯, 目前只是改了一下OSChina的几个主要DIV宽度而以,还是很粗糙, 以后会慢慢改进的. 
------------------------------------------------------------------------------------------------------------

确实, 把一个连半成品都算不上的东西放出来, 是一种很傻逼的行为. 
而昨晚,我刚好这么做了. 哪怕我早已经声明 "目前...很粗糙".

一开始,我加载远程css, 由于缓存和延时的原因, 操作起来并不方便. 
一堆的 "+=" , 那是因为我经常神经发作,用 firebug, 看哪太小, 就改哪.没有头绪,没有计划. 仅仅只是为了效果早点出来而已.

好吧, 骂声一片, 我也只好计划一下, 一步步来. 
1. 先计算好宽度,再调整, 而不是随便写上 500px 之类. 
2. 还是会继续使用 css+= .... 
3. 宽度调整到自己满意之后, 调整配色, 以 douban 为参考. 
4. 压缩 css, 保持简洁. 
5. 把 css 分离出来, 放到自己的服务器上,动态加载. 
   js 会被压缩到3行.

声明: 
它只是用来重置OSChina默认的CSS. 
它只是写来自己用而已, 我不对任何人负责. 
如果你用得上, 你可以拿走. 
如果你有建议, 请留言. 
如果你看着不爽, 请飞过. 
​1. [代码][JavaScript]代码     http://www.huiyi8.com/ppt/​
// ==UserScript==
// @name           OSC
// @namespace      osc
// @include        http://www.oschina.net/question*
// @include        http://www.oschina.net/news/*
// @include        http://www.oschina.net/
// @include        http://my.oschina.net/*
// ==/UserScript==
 
function addOscStyle() {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.id = 'zhi';
    var css = '';
    css += 'body{font-size:14px;}';
    css += '.QuestionList ul li.question .qstat ul li.answer{color:#000;background:none;}';
    css += '#OSC_Screen{min-width:1000px;width:98%;}';
    css += '.QuestionList{min-width:770px;width:1200px;}';
    css += '.QuestionListRight{width:500px;}';
    css += 'a.tag{background-color:none;border:none;}';
    css += '.QuestionList ul li.question h2{font-size:18px;}';
    css += '.QuestionList ul li.question a.user{width:55px;height:55px;margin:auto 10px;}';
    css += '.QuestionList ul li.question a.user img{width:50px;height:50px;border-radius:8px;}';
    css += '.QuestionList ul li.question .Tags{width: auto; float: right;}';
    css += '.QuestionList ul li.question .qbody{width:940px;}';
    css += '#CatalogTags ul li a{border-radius:5px;}';
    css += '.QuestionList ul li.question .Date{float:left;font-size:14px;width:auto;}';
    css += '.QuestionList ul li.question h2 a{color:#333;}';
    css += '.QuestionListRight .TopUsers ul li{font-size:14px;width:90px;height:76px;}';
    css += '.QuestionListRight .TopUsers ul li img{width:53px;height:53px;border-radius:8px;}';
    css += '.QuestionListRight #QuestionWizard{float:left;display:block;}';
    css += '.QuestionListRight #TopUsers{display:block;float:left;}';
    css += '.QuestionListRight #PopularTags{float:right;display:block;width:248px;display:none;}';
    css += '.Question .Body{width:1200px;font-size:16px;}';
    css += '.Question .Body .Content{width:1200px;}';
    css += '.Question .Body .Content .detail{font-size:16px;}';
    css += '.Question .Body .Vote{width:202px;}';
    css += '.Question .Body .Vote a{width:200px;float:left;}';
    css += '.Question .Body .Vote .vote-count-post{width:50px;float:left;width:120px;}';
    css += '.QuestionReplies .Answer .user{width:55px;height:55px;margin:auto 10px;}';
    css += '.QuestionReplies .Answer .user img{width:50px;height:50px;border-radius:8px;}';
    css += '.QuestionReplies .Answer .body{width:1120px;margin-top:10px;}';
    css += '.Question .QuestionRelations{width:500px;}';
    css += '.Question .QuestionRelations #Similarity ul li a{font-size:18px;}';
    css += '.Question .Title .QTitle{width:1000px;}';
    css += '.Question .Title .QTitle h1{width:900px;}';
    css += '.Question .Title .Asker{width:55px;height:55px;margin:auto 10px;}';
    css += '.Question .Title .Asker img{width:50px;height:50px;border-radius:8px;}';
    css += '.QuestionReplies .Best{background: url("../img/2011/best.gif") no-repeat scroll 80px 10px #EEFFEE}';
    css += '.QuestionList ul li.question{padding:10px 0;margin:0px;}';
    css += '.QuestionList ul li.question:nth-child(2n){background-color:#DDD;}';
    css += '.QuestionReplies .Answer .replies ul li{padding-left:5px;}';
    css += '.QuestionReplies .Answer .replies ul li:nth-child(2n-1){background-color:#DDD;border-radius:3px;}';
    css += '.QuestionReplies .Answer .replies ul li a.p{font-size:14px;width:60px;height:60px;margin:10px;padding-right:10px;border-right:1px solid #555;}';
    css += '.QuestionReplies .Answer .replies ul li a.p img{width:53px;height:53px;border-radius:8px;}';
    css += '.QuestionReplies .Answer .replies ul li .b{padding-top:10px;width: 1000px;}';
    /* news */http://www.huiyi8.com/ppt/​
    css += '#OSC_Content td.left{width:1200px;}';
    css += '.Comments ul li .portrait{padding:10px 0 0 10px;width:80px;height:80px;}';
    css += '.Comments ul li .portrait img{width:50px;height:50px;border-radius:8px;}';
    css += '.Comments ul li.row_0 {background-color:#DDD;border-radius:8px;}';
    /* 空间 */ppt模板
    css += '#LSpace{width:450px;background-color:#DDD;border-left-width:5px;padding:10px;border-radius:8px;}';
    css += '#MSpace{width:800px;}';
    css += '#RSpace{width:440px;}'
    css += '#Logs .Log .post{width:700px;font-size:16px;line-height:20px;}';
    css += '#Logs .userlogs li.Tweet{margin-bottom:30px;}';
    css += '#Logs .portrait{width:80px;height:80px;}';
    css += '#Logs .portrait img{width:50px;height:50px;border-radius:8px;}';
    css += '#Owner #img img{border-radius:8px;}';
    css += '#Owner #oimg img{border-radius:8px;}';
    css += '.Users ul li{width:80px;height:75px;}';
    css += '.Users ul li img{width:50px;height:50px;border-radius:8px;}';
    css += '.Users ul li a em{font-size:14px;}';
    css += '.TweetRpls .p{width:80px;}';
    css += '.TweetRpls .p a{width:80px;height:80px;}';
    css += '.TweetRpls .p img{width:50px;height:50px;border-radius:8px;}';
    css += '.TweetRpls .m{width:580px;}';
    /* 首页 */
    css += '.TodayNews{width:700px;}';
    css += '.mod,.mod h2{border-radius:8px;}';
    //css += '#DynaInfo{width:400px;}';
    css += 'td[width="280"] {width:400px;}';
    css += '#DynaInfo ul li .portrait{width:80px;height:80px;}';
    css += '#DynaInfo ul li .portrait img{width:50px;height:50px;border-radius:5px;}';
    /* 默认字体大小 */
    css += '#OSC_Screen{font-size:16px;line-height:20px;}';
    css += '#DynaInfo ul li .user a,#DynaInfo ul li .log{font-size:16px;line-height:20px;}';
 
    style.innerHTML = css;
    head.appendChild(style);
}
addOscStyle();

重置 oschina 的CSS的更多相关文章

  1. 重置默认样式 css reset

    html { overflow-x:auto; overflow-y:scroll; } body, dl, dt, dd, ul, ol, li, pre, form, fieldset, inpu ...

  2. 页面重置样式reset.css

    我把经常用到的一些页面重置样式归类到了一个.css文件中,这样可以减少代码冗余.当然还有其他的很多用处,比如h1~h5的样式全部统一的话,下面写东西很清晰很多. @charset 'utf-8'; h ...

  3. css reset重置样式有那么重要吗?

    在以前写html代码的时候,一般都会在head里添加重置样式reset.css,其内容如下: @charset "utf-8"; html, body, div, span, ap ...

  4. CSS 重置默认样式

    1. 概述 1.1 说明 css重置样式主要是为了让各个浏览器的CSS样式有一个统一的基准,使HTML元素样式在跨浏览器时有一致性的效果. 备注:浏览器的兼容问题,不同浏览器对有些标签的默认值是不同的 ...

  5. CSS工具、CSS重置(CSS Reset)

    样式重置的目的是减少浏览器的不一致性,例如line-height,margin,标题的font-size大小等等.样式重置经常在CSS框架中出现. 这里的重置样式故意写的很一般,例如没有为body元素 ...

  6. 什么是CSS重置,有些什么作用?

    CSS重置是什么? 简单的说就是重置浏览器的CSS默认属性. 为什么要重置它,有什么作用? 因为浏览器的品种很多,每个浏览器的默认样式也是不同的,比如<button>标签,在IE浏览器.F ...

  7. 这些HTML、CSS知识点,面试和平时开发都需要 No1-No4

    系列知识点汇总 这些HTML.CSS知识点,面试和平时开发都需要 No1-No4(知识点:HTML.CSS.盒子模型.内容布局) 这些HTML.CSS知识点,面试和平时开发都需要 No5-No7(知识 ...

  8. 【转】}目前比较全的CSS重设(reset)方法总结

    在当今网页设计/开发实践中,使用CSS来为语义化的(X)HTML标记添加样式风格是重要的关键.在设计师们的梦想中都存在着这样的一个完美世界:所有的浏览器都能够理解和适用多有CSS规则,并且呈现相同的视 ...

  9. Normalize.css 初识

    一. 用来干嘛的 一个现代的.准备好了支持 HTML5 技术,并且要替代 CSS Reset 处理样式的理念. Normalize.css 使浏览器渲染所有元素更加一致,并且符合现代标准.它只是针对那 ...

随机推荐

  1. 自动改变html font-size,实现移动端rem适配

    移动端采用rem适配非常方便 比如在iphone6尺寸下,将html font-size 设置为 100px,那么写css时,只要将尺寸/100 + rem 即可. 在iphone6Plus尺寸下,h ...

  2. JSP开发中的基础语法

    JSP 语法 JSP开发中的基础语法. 脚本程序 脚本程序可以包含任意量的Java语句.变量.方法或表达式,只要它们在脚本语言中是有效的. 脚本程序的语法格式: <% 代码片段 %> 或者 ...

  3. AR9331出现connect-debounce failed,port 1 disabled解决方法备忘

    基于AR9331的路由器,自己画的pcb板子,居然出现这个错误,百度下,貌似有不少人遇见过这个错误,可是在改动板子前我的固件用的是没问题的.USB完美使用 改动过板子后出现这个问题! hub 1-0: ...

  4. Shiro 认证失败返回JSON

    Shiro框架默认认证失败后会返回到登录页面,在前后端分离项目中,需要返回JSON数据,以便前端或者app端解析处理. 实现方式: 1. 扩展shiro框架的UserFilter类,重写redirec ...

  5. Linux进程间通信(二) - 消息队列

    消息队列 消息队列是Linux IPC中很常用的一种通信方式,它通常用来在不同进程间发送特定格式的消息数据. 消息队列和之前讨论过的管道和FIFO有很大的区别,主要有以下两点(管道请查阅我的另一篇文章 ...

  6. willMoveToParentViewController和didMoveToParentViewController

    本文转载至 http://blog.csdn.net/yongyinmg/article/details/40619727 iOS 5.0 后UIViewController新增:willMoveTo ...

  7. TP框架---thinkphp表单验证

    自动验证是ThinkPHP模型层提供的一种数据验证方法,可以在使用create创建数据对象的时候自动进行数据验证.验证的代码要写在模型层即Model里面. 数据验证有两种方式: 静态方式:在模型类里面 ...

  8. 爬虫入门【2】Requests库简介

    发送请求 使用Requests发送网络请求很简单 #首先要导入requests库 import requests #返回一个Response对象 r=requests.get('https://git ...

  9. ArcGIS API for js InfoWindow

    说明:有关该示例中怎么引用部署在iis上的离线arcgis api请参考我前面的博文 1.运行效果 2.HTML代码 <!DOCTYPE html> <html> <he ...

  10. 一些blog地址总结整理:

    女神 python之路-网络编程初版:https://www.cnblogs.com/Eva-J/articles/8066842.html python之路-网络编程(重点看这个,更细致):http ...