??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
I have noticed myself to use a few different code snippets on a daily basis so I thought some of you might find them useful. So here we go.
The CSS
This is an oldie, but apperantly it is not as obvious as you would think.
Sticky Footer (make footer always be on bottom without absolute positioning)
The HTML
The CSS
As of recently i have had to use this over 50 times… i think this is one of the most important tricks you will learn today.
Cross-Browser Min Height
The CSS
You can replace the min-height and heigth with 12em or another value that works for you.
Box Shadow (CSS3)
The CSS
As you can see since this is a CSS3 property you will need all the three commands to make it cross browser(except for ie of course). The first 2 measurements are for horizontal offset and the vertical offset. The third number is for the blur radius. And the last is the color of the shadow.
Text Shadow (CSS3) with IE hack
The CSS
This technique is great for all modern browsers, the IE fix works but it is not amazing quality.
Cross Browser CSS Opacity
The CSS
Opacity can be used for plenty of elements, it adds a certain new age style we all strive for. Notice that in some browsers transperancy is inherited by all child elements!
The Famous Meyer Reset
The CSS
This is the most useful css reset out there, i use it for almost everything I work on (even the 52framework, coming soon).
Removing the dotted outlines
The CSS
I find myself getting very annoyed with the dotted outline (especially for text-indented elements that are off the page).
Rounded Corners (non ie)
The CSS
Love rounded corners? Don’t want to slave over images and elements to get the effect? This is your solution, and elements still look fine in ie.
Override Inline Styles
The CSS
This comes in handy plenty of times, I personally use it way too much everytime something doesn’t work I test if its just not being applied because of some other style.
ul.demolayout {
list-style-type: none;
float: left;
margin:0px;
padding:0px;
}
ul.demolayout li {
margin: 0 0 0 0;
float: left;
border-bottom:1px solid #515151;
}
.tab{
padding:0 0 2px 0;
height: 160px;
text-align:left;
}
ul.demolayout a {
float: left;
display: block;
padding: 5px 25px;
border-bottom: 0;
color: #515151;
text-decoration: none;
font-size:14px;
font-weight: bold;
}
ul.demolayout a:hover {
background: #eee;
}
ul.demolayout a.active {
background: #515151;
padding-bottom: 5px;
cursor: default;
color:white;
}
.tabs-container {
clear: left;
padding:0px;
}
p.more_details{
padding:2px 2px 2px 2px;
font-size:11px;
}
</style>
</HEAD>
<BODY>
<div id="demo" class="demolayout">
<ul id="demo-nav" class="demolayout">
<li><a class="active" href="#tab1" id="1">zd资讯</a></li>
<li><a class="" href="#tab2" id="2">业态分?lt;/a></li>
<li><a class="" href="#tab3" id="3">商家推荐</a></li>
</ul>
<div class="tabs-container">
<div style="display: block;" class="tab" id="tab1">
<p class="more_details">
zd资讯内容信息
</p>
</div>
<div style="display: none; " class="tab" id="tab2">
<p class="more_details">
业态分布内容信?br />
</p>
</div>
<div style="display: none; " class="tab" id="tab3">
<p id="comment" class="more_details">
商家推荐内容信息
</p>
</div>
</div>
</div>
</BODY>
</HTML>
b.rtop, b.rbottom{display:block; background: #FFF;}
b.rtop b, b.rbottom b{display:block;height: 1px;
overflow: hidden; background: #FF9E3E;}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}
.prod_title{
color:#804000;
text-align:center;
font-size:14px;
font-weight: bold;
padding: 5px 5px;
}
div.details{
padding:2px;
font-size:11px;
text-align:left;
}
.box_center{
width:200px;
height:150px;
padding: 2px;
}
a.more{
font-style:italic;
color:#804000;
float:right;
text-decoration:none;
font-size:11px;
padding:0px 15px 0 0;
}
</style>
</HEAD>
<BODY>
<div id="box">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<div class="box_center">
<div class="prod_title">圆角试</div>
<div class="details">内容信息</div>
<a href="#" class="more">- 详细信息 -</a>
<div class="clear"></div>
</div>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>
</BODY>
</HTML>
COMSHARP CMS 写道Q在U编辑内容的时候,那些Z JavaScript 的编辑器帮了我们大忙Q这些所见即所得(WYSIWYGQ编辑器Q给我们提供了类?Office 的操作体验。如今,M|站内容理pȝQCMSQ和博客pȝ都需要一个这L~辑器。本文精选了10个基?JavaScript 的编辑器Q它们有的是Z jQuery 框架Q有点则不是?/p>
功能不是很多Q但很轻量,很灵zR打包后只有6.5K大小?/p>
非常基本的编辑器Q简单ؓ本。打包后只有7K?/p>
单到不能再简单,很容易自׃攏V?/p>
跨浏览器Q开源,Z jQuery。可以很Ҏ同各U?CMSQ论坛,留言本,博客{系l集成?/p>
Z iframe 对象?/p>
<!-- ################## NON jQUery ################### -->
最l典的基?JavaScript 的编辑器QCOMSHARP CMS 默认的编辑器是q个?/p>
功能非常强大?/p>
Z Yahoo YUIQ简单,但很可靠?/p>
自由的基?nbsp; BSD 许可~辑器,功能完善Q很适合同各U系l集成?/p>
本文原文来源Q?a >http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors
package com.founder.web.ext;
import Java.util.Date;
import Java.util.HashMap;
import Java.util.Map;
import org.jmesa.core.filter.DateFilterMatcher;
import org.jmesa.core.filter.FilterMatcher;
import org.jmesa.core.filter.FilterMatcherMap;
import org.jmesa.core.filter.MatcherKey;
public class DateFilterMatcherMap implements FilterMatcherMap {
public Map<MatcherKey, FilterMatcher> getFilterMatchers() {
Map<MatcherKey, FilterMatcher> filterMatcherMap = new HashMap<MatcherKey, FilterMatcher>();
filterMatcherMap.put(new MatcherKey(Date.class, "born"), new DateFilterMatcher("MM/dd/yyyy"));
return filterMatcherMap;
}
}
现在需要修?span class="pln">tableFacade标签?/p>
<jmesa:tableFacade
id="tag"
filterMatcherMap="com.founder.web.ext.DateFilterMatcherMap"
<br>
<br>
textarea宽度固定Q自动增?lt;br>
<textarea type="text" style="width:260;overflow-y:visible;"></textarea>
<BODY>
<p>Move your mouser over the red square.</p>
<div id="div1" style="background-color:red; height:50px; width:50px" onmouseover="showTip(event);" onmouseout="hideTip(event);"><div>
<div id="divTip1" style="background-color:yellow;position:absolute;visibility:hidden;padding:5px">
<span style="font-weight:bold">Custom Tooltip</span><br/>
</div>
</BODY>
</HTML>
<BODY>
<div style ="background-color:blue; color:white; font-weight:bold; padding:10px; cursor:pointer" onclick="toggle('divContent1');">Click Here</div>
<div style="border:3px solid blue; height:100px;padding:10px" id="divContent1">
This is some content to show and hide.
</div>
<div style ="background-color:blue; color:white; font-weight:bold; padding:10px; cursor:pointer" onclick="toggle('divContent2');">Click Here</div>
<div style="border:3px solid blue; height:100px;padding:10px" id="divContent2">
This is some content to show and hide.
</div>
</BODY>
</HTML>
具体使用办法Q?br /> ?a target="_blank" rel="nofollow">snap|站可以甌CD늱g下Ş式的代码Q?br />
<script defer id="snap_preview_anywhere" type="text/javascript" src="http://spa.snap.com/snap_preview_anywhere.js?ap=1&key=739080a127808f9856fa43a8c91c4d21&sb=1&domain=dimlau.com"></script>
下面说说代码的修改:
1、用默认的代码Q鼠标移动到链接上时昄的效果是带搜索框的,但是可以通过修改代码来去掉搜索框Q先看效果对比:
修改Ҏ是,获得代码中?strong>sb=1Ҏsb=0
2、默认代码效果是面中的所有链接都有鼠标划q时昄~略图效果?/strong>如果你想Ҏ个特定链接禁用羃略图效果Q可以对该链接加上一个分cL标识Q?br /> 例如链接
<a href="xxxx">xxx</a>Q禁用羃略图的方法是写成
<a href="xxxx" class="snap_nopreview">xxx</a>
通常Q一个页面里大部分链接我们都不想加入~略囄Q所以上q办法有点烦琐了?br /> 其实可以通过修改代码中的ap=1?strong>ap=0来ə面的所有链接在默认情况下不昄~略图,q时只有链接写成以下格式的情况下才会有羃略图昄Q?br />
<a class="snap_preview" href="XXX">XXX</a>
对于上述各种情况Q如果链接本w已l有了某个class分类Q比如已l分cMؓclass="123",可以?strong>I格来分隔,q赋予多个class分类Q比?br /> class="123 snap_nopreview"或者class="123 snap_preview"
以上为本人的一点小心得,希望对各位看官有点帮助?br /> --------------------------------------------------------------------------------------------------------
对于我用的MTQ可以对模版中的评论者网站链接Ş式加入一个class="snap_preview"来实现对评论者网站界面的初步预览Q我觉得是个不错的小工具?br />
当然其他E序Q也可以做相应的修改实现该效果。我׃再多说了?/p>
body {background-color:red;}
W二个是背景为绿色的CSS文gQ?/span>green.cssQ?/span>CSS中的内容为:
body {background-color:green;}
W三个是背景为黄色的CSS文gQ?/span>yellow.cssQ?/span>CSS中的内容为:
body {background-color:yellow;}
然后?/span>xthml文g中加入这三个CSS的链?/span>
<link rel="alternate stylesheet" href="red.css" type="text/css" title="red" media="screen, projection"/>
<link rel="stylesheet" href="green.css" type="text/css" title="green" media="screen, projection"/>
<link rel="alternate stylesheet" href="yellow.css" type="text/css" title="yellow" media="screen, projection"/>
q三个中除了title不一样外q有一个地Ҏ所不同Q那是REL。第一个与W三个都?/span>alternate stylesheet只有W二个是stylesheet。这W二个就是当然样式?/span>
在链接下面再导入一?/span>JS文gQ用来控制这个样式切?/span>
function setActiveStyleSheet(title) {
var i, a, main;
if (title) {
for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title')) {
a.disabled = true;
if(a.getAttribute('title') == title) a.disabled = false;
}
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled) return a.getAttribute('title');
}
return null;
}
在合适的地方加入三个切换按钮
<a href="javascript :void()" onclick="setActiveStyleSheet('red'); return false;" title="U色样式"></a>
<a href="javascript :void()" onclick="setActiveStyleSheet('green'); return false;" title="l色样式"></a>
<a href="javascript :void()" onclick="setActiveStyleSheet('yellow'); return false;" title="黄色样式"></a>
<a href="javascript :void()" onclick="setActiveStyleSheet('none'); return false;" title="没有样式"></a>
好了发布试试炚w三个切换链接Q是不是已经切换了样式?
补遗Q带有记忆功能的JS文档
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName
("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style")
!= -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title)
a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName
("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style")
!= -1 && a.getAttribute("title") && !a.disabled)
return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName
("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+";
path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return
c.substring(nameEQ.length,c.length);
}
return null;
}
window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie :
getPreferredStyleSheet();
setActiveStyleSheet(title);
}
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie :
getPreferredStyleSheet();
setActiveStyleSheet(title);
disc | Default. Solid circles. |
circle | Outlined circles. |
square | Solid squares. |
decimal | 1, 2, 3, 4, and so on. |
lower-roman | i, ii, iii, iv, and so on. |
upper-roman | I, II, III, IV, and so on. |
lower-alpha | a, b, c, d, and so on. |
upper-alpha | A, B, C, D, and so on. |
none | No marker is shown |