Common CSS statements

Source: Internet
Author: User
Controls the display and hiding of horizontal and vertical scroll bars?
<Body style = "overflow-Y: hidden"> remove the X axis.
<Body style = "overflow-X: hidden"> remove the Y axis.
<Body scroll = "no"> hide
Table color change
<TD onmouseover = "This. style. backgroundcolor = '# ffff '"
Onmouseout = "This. style. backgroundcolor = ''"
Style = "cursor: Hand">

Prohibit copying, drag and select
<Body ondragstart = Window. event. returnvalue = false oncontextmenu = Window. event. returnvalue = false onselectstart = event. returnvalue = false>

Common IFRAME page
<IFRAME name = "name" src = "main.htm" width = "450" Height = "287" scrolling = "Auto" frameborder = "0"> </iframe>
IFRAME adaptive height
<IFRAME name = "pindex" src = "index. ASP "frameborder = false scrolling =" Auto "width =" 100% "Height =" 100% "frameborder = No onload =" document.allpolic'pindex').style.height?pindex.doc ument. body. scrollheight "> </iframe>

Change to your own icon in front of the IE Address Bar & your icon can be displayed in favorites
<LINK rel = "shortcut icon" href = "favicon. ICO">
<LINK rel = "bookmark" href = "favicon. ICO">

Font size scaling
More and more people are making a bubble for a long time, and the penetration rate of glasses is getting higher and higher, which makes the text bigger and clearer to more users.
<SCRIPT type = "text/JavaScript">
Function dozoom (size)
{Document. getelementbyid ('zoom '). style. fontsize = size + 'px ';}
</SCRIPT>
<Span id = "zoom"> text to be specified </span>
<A href = "javascript: dozoom (16)"> large </a> <a href = "javascript: dozoom (14) "> medium </a> <a href =" javascript: dozoom (12) "> small </a>

How to block Div with select
Add the following code to the DIV and adjust it as needed.
<IFRAME src = "javascript: false" scrolling = "no" frameborder = "0" style = "Z-index:-1; position: absolute; top: 5px; left: 2px; width: 168; Height: 100px; ">
</Iframe>
IFRAME (embedded frame) Adaptive height
The entered embedded address must be on the same site as the current page. Otherwise, the system will prompt "Access Denied !". You have permission for cross-Origin references. For more information, see.
<IFRAME name = "Guestbook" src = "gbook/index. ASP "scrolling = no width =" 100% "Height =" 100% "frameborder = No onload =" document.all+'guestbook').style.height#guestbook.doc ument. body. scrollheight "> </iframe>

New jump menu window
<Select name = "select" onchange = "window. Open (this. Options [This. selectedindex]. Value)">
<Option value = "http://www.microsoft.com/ie"> Internet Explorer </option>
<Option value = "http://www.microsoft.com"> Microsoft home </option>
<Option value = "http://msdn.microsoft.com"> Developer Network </option>
</SELECT>

Flash Transparent options
<Param name = "wmode" value = "Transparent">

Add to favorites and set as Homepage
Add to favorites:
<A href = "javascript: window. External. AddFavorite ('HTTP: // link', 'description');"> Add to favorites </a>
Set as homepage:
<A href = # onclick = This. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // link');> set as homepage </a>

Record and display the last modification time of the webpage
<Script language = JavaScript>
Document. Write ("Last Update time:" + document. lastmodified + "")
</SCRIPT>

Holiday countdown
<Script language = "JavaScript">
VaR TimeDate = new date ("October 1,2002 ");
VaR times = "National Day ";
VaR now = new date ();
VaR date = TimeDate. gettime ()-Now. gettime ();
VaR time = math. Floor (Date/(1000*60*60*24 ));
If (Time> = 0)
Document. Write ("now" + times + "and:" + time + "day ")
</SCRIPT>

Add to head
Disable caching
<Meta http-equiv = "expires" content = "0">
<Meta http-equiv = "cache-control" content = "no-Cache">
<Meta http-equiv = "Pragma" content = "no-Cache">
Make the background of documents in the IFRAME framework transparent
<IFRAME src = "about: <body style = 'background: transparent'>" allowtransparency> </iframe>

Maximize when a window is opened
<Script language = "JavaScript">
<! -- Begin
Self. moveTo (0, 0)
Self. resizeTo (screen. availwidth, screen. availheight)
// End -->
</SCRIPT>

Add background music
<Bgsound src = "mid/windblue [1]. Mid" loop = "-1"> only applicable to IE
<Embed src = "music. Mid" autostart = "true" loop = "true" hidden = "true"> applicable to both Netscape and IE

Scroll
<Marquee direction = up Height = 146 onmouseout = start () onmouseover = stop () scrollamount = 2> scroll Information
</Marquee>

When you click an empty link, the page is often reset to the header.
The Code "javascript: void (null)" replaces the original "#" mark

Text or image pop-up window of the specified size
Add in Body
<Script language = "JavaScript" type = "text/JavaScript">
Function mm_openbrwindow (theurl, winname, features) {window. Open (theurl, winname, features );}
</SCRIPT>
Pop-up code
<A href = "#" target = "_ Self" onclick = "mm_openbrwindow('windows01.htm','', 'width = 550, Height = 380 ') "width =" 550 "Height =" 380 "border =" 0 "> image or text </a>

Flash button and link
On (Press ){
Geturl ("http://www.makewing.com", "_ blank ");
}

Jump Page code
<Meta http-equiv = "refresh" content = "5; url = http://www.makewing.com">

Line separation line
<HR noshade size = 0 color = # c0c0c0>

Automatic line feed in Web pages
<TD style = "word-break: Break-all">.
Complete is
Style = "table-layout: fixed; Word-break: Break-all; Word-wrap: Break-word"

Remove the image toolbar that automatically appears in IE6 and set the galleryimg attribute to false or no.

Prohibit page body content from being selected
<Body oncontextmenu = "Return false" ondragstart = "Return false" onselectstart = "Return false" onselect = "document. selection. empty () "oncopy =" document. selection. empty () "onbeforecopy =" Return
False "onmouseup =" document. selection. Empty () ">
You cannot right-click it, or press Ctrl + A to copy it!
<Body oncontextmenu = "window. event. returnvalue = false"
Onkeypress = "window. event. returnvalue = false"
Onkeydown = "window. event. returnvalue = false"
Onkeyup = "window. event. returnvalue = false"
Ondragstart = "window. event. returnvalue = false"
Onselectstart = "event. returnvalue = false">
</Body>

Internet Explorer supports a body attribute bgproperties, which can prevent the background from rolling:
<Body background = "Image File" bgproperties = "fixed">

Random conversion of background images (a special effect that refreshes the mood)
<Script language = "JavaScript">
Image = new array (4); // defines the image as an array of the number of images.
Image [0] = 'tu0.gif '// path of the background image
Image [1] = 'tu1.gif'
Image [2] = 'tu2.gif'
Image [3] = 'tu3.gif'
Image [4] = 'tu4.gif'
Number = math. Floor (math. Random () * image. Length );
Document. Write ("<body background =" + image [number] + "> ");
</SCRIPT>
Loading video in Flash
On (Release)
{
Loadmovie ("1-01.swf", "_ root. loaderclip ");
}

Image form button
<Form ID = "form1" name = "form1" method = "Post" Action = "">

</Form>

CSS definition method for Left and Right shadow backgrounds
Body {
Text-align: center;
Background-repeat: Repeat-y;
Background-position: center;
Background-image: URL (../images/bg.jpg );
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.