Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Monday, September 22, 2014

Weird flickering effect with HTML/CSS

Just found out that when using in-page popups, using this CSS breaks the page so that it starts flickering/strobing constantly sometimes :D
html {overflow: auto;}

So word of advice: don't use it :) Or use it with some other parameter than "auto".

Wednesday, August 20, 2014

Set the best DOCTYPE for Sharepoint 2010, Sharepoint doctype declarations for HTML5 & CSS3

When working with advanced Sharepoint designs, one usually wants to change the document type to allow for more relaxed syntax and opportunities.

On the top of your Master page, add this:
<!DOCTYPE html>

It changes the document type to a HTML5-compliant mode.
Remember to change the meta tag "X-UA-Compatible" to a newer version, or delete it completely:
<meta http-equiv="X-UA-Compatible" content="IE=8"/>

Otherwise Internet Explorer will render the page in IE8 compatibility mode, so CSS3 & HTML5 won't work.

When using an older environment, this DOCTYPE declaration seems to be the best and also the most relaxed: HTML 4.0 Transitional in Standards Mode

So, type the following line to the top of your Master page, where the previous setting is, overwriting it:
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">

Remember, don't change the DOCTYPE in your regular pages, only in the Master page! Because it doesn't work that way, it has to be on top of the rendered(master) page.

EDIT: Sometimes it might be best NOT to include any doctype definition, that might break old IE. See more info in this link:
Lots of more info & experience here.

Wednesday, November 14, 2012

Simple Menu with HTML, CSS & jQuery

Here we have a simple menu and CSS Sprite styling example. HTML: CSS: /* Custom Menu */ ul { list-style-type: none; } ul#nav li, ul#nav li a { background: url('../images/oldmenuexamplesprite.png') no-repeat left top; height: 31px; } /* We give the and the sprite as the background and set the button dimensions */ ul#nav li { float: left; border: 0px solid #243e3b; border-left: none; } ul#nav li a { display: block; text-indent: -9999px; } ul#nav li.info a { width: 93px; } /* Here we set the button widths. */ ul#nav li.updates a { width: 111px; } ul#nav li.media a { width: 83px; } ul#nav li.downloads a { width: 138px; } ul#nav li.forums a { width: 140px; } ul#nav li.info a { background-position: 0px 0px; } /* Here we set the background/sprite position */ ul#nav li.updates a { background-position: -93px 0px; } ul#nav li.media a { background-position: -204px 0px; } ul#nav li.downloads a { background-position: -287px 0px; } ul#nav li.forums a { background-position: -425px 0px; } ul#nav li.info a:hover { background-position: 0px -34px; } /* And now the hover background-position position */ ul#nav li.updates a:hover { background-position: -93px -34px; } ul#nav li.media a:hover { background-position: -204px -34px; } ul#nav li.downloads a:hover { background-position: -287px -34px; } ul#nav li.forums a:hover { background-position: -425px -34px; } jQuery: (function ($) { /* Needed for Drupal 7 */ $(document).ready(function(){ //Set the anchor link opacity to 0 and begin hover function $("ul#nav li a").css({"opacity" : 0}).hover(function(){ //Fade to an opacity of 1 at a speed of 200ms $(this).stop().animate({"opacity" : 1}, 200); //On mouse-off }, function(){ //Fade to an opacity of 0 at a speed of 100ms $(this).stop().animate({"opacity" : 0}, 100); }); //Add more jQuery functionality here... }); })(jQuery); /* Needed for Drupal 7 */