Archive for the ‘CSS’ Category

April 26th, 2013

55+ Great and Useful Tools for Responsive Web Design

Responsive web design is becoming more popular day by day because users can browse such web designs from a variety of devices. For example, desktop, mobile phones, tablets, netbooks and so forth just to name a few. The reason why responsive web designs are so popular among designers is that they allow them to furnish different layouts for specific devices.

55+ Great and Useful Tools for Responsive Web Design

Today, in this collection we have gathered for you 55+ superb, great and useful tools for responsive web design. These tools are designed by very talented developers and can help you with your responsive website designs and also offer great tablet and smartphone user experience.

Great and Useful Tools for Responsive Web Design

Getting Started, Learning

Style Tiles
Designer Style Tiles introduces a new technique in the world of responsive website design. All these designs are like swatches or moodboards and therefore, it shows the general design approach.

Style Tiles

Responsive Web Design Sketch Sheets
This set will help you in mapping out how you can change page sections in different resolutions.

Responsive Web Design Sketch Sheets

Responsive Design Sketchbook
This set contains a sketchbook in which you can easily keep your all sketches and save time too.

Responsive Design Sketchbook

Responsive Wireframes
In this experimental tool, you will see how responsive wireframing of complex website layouts work.

Responsive Wireframes

Multi-Device Layout Patterns
With this tool, you can see how other designers have approached responsive Multi-Device Layout Patterns. It is a superb place to start your own Multi-Device Layout Pattern because it contains a list of popular patterns with links.

Multi-Device Layout Patterns

Simple Device Diagram
This tool makes it easy for you to choose what device widths to design to. This tool contains the ideal width for the design of 3 layout sites, 4 layout sites etc.

Simple Device Diagram

Responsive Design with Mockups
Here, you will find a library of mockup templates along with a tutorial on how to do wireframing.

Responsive Design with Mockups

Responsive Image and Text Tools

Responsive Images
This is an experimental image scaling tool that can scale your images responsively.

Responsive Images

Adaptive Images
Adaptive Images detects your visitor’s screen size and automatically creates, caches, and delivers device appropriate re-scaled versions of your web page’s embeded HTML images. No mark-up changes needed

Adaptive Images

Seamless Responsive Photo Grid
If you want to show images edge-to-edge without any gaps inbetween images on the browser, then this tool will help you.

Seamless Responsive Photo Grid

FitText
With this tool, you can make font sizes flexible and in this way you can achieve scalable headlines.

FitText

slabText
This is a jQuery plug-in that will help you make bold blocks of text that can be resized responsively.

SlabText

Retina Images
This tool will help you to show 2x larger, high-resolution images when viewed on retina display devices.

Retina Images

Flexible/fluid Grid, Media Queries

Variable Grid System
With this fluid grid system, you can easily create an underlying CSS grid for your website.

Variable Grid System

Responsive Calculator
With this calculator you can simply change your PSD pixel perfection into the start of your responsive website.

Responsive Calculator

Gridpak
Improve your workflow and save time with GridPak that can generate PNGs, CSS and JavaScript for your responsive website layout.

GridPak

Semantic Grid System
This tool lets you set column and gutter widths along with the number of columns. Moreover, you can switch between pixels and percentages, and can achieve responsive layouts.

Semantic Grid System

Columnal CSS Grid System
This grid system helps you to create more responsive website designs in an easy way. This is a fluid grid system that responds well to the width of most browsers.

Columnal CSS Grid System

Simple Grid
This is an easy to use grid system that will help you create responsive website layouts.

Simple Grid

Golden Grid System
With this tool you can easily create 18 even columns 16 central columns to be used for designing purposes while the leftmost and rightmost columns are used as outer margins.

Golden Grid System

1140 CSS Grid
This grid system works best on smaller screens and becomes fluid and adapts to the width of the web browser.

1140 CSS Grid

Susy
With this tool you can create a grid system that does not make use of any extra markup or special classes.

Susy

Respond.js
This is athe fast and lightweight polyfill for minimum or maximum width CSS3 Media Queries.

Respond.js

CSS3-Mediaqueries.js
With this tool you can enable older versions of IE as well as other web browsers to efficiently try out and employ all types of media queries.

CSS3 Mediaqueries.js

Adapt.js
This tool will automatically decide which CSS file to load prior to the browser rendering a page. Furthermore, this tool only serves the needed CSS files if the browser is resized.

Adapt.js

Categorizr
This script will help you serve your website as a mobile website unless otherwise detected as a desktop or tablet and thus, serve resources to web browsers in an appealing manner.

Categorizr

ProtoFluid
With this tool, you can quickly do prototyping for adaptive CSS, fluid layouts and responsive web designs.

ProtoFluid

Tiny Fluid Grid
Tiny Fluid Grid will help you to find out the grid system for your design and it is a web based app that offers you downloadable CSS for your responsive grid.

Tiny Fluid Grid

1Kb CSS Grid
With this CSS generator, one can easily generate a downloadable CSS file for the website grid with the set numbers of columns along with columns and gutter widths.

1Kb CSS Grid

mediaQuery Bookmarklet
Create a visual representation of the recent viewport dimensions as well as the most freshly fired media query.

mediaQuery Bookmarklet

April 25th, 2013

How to Create a “Sticky” Floating Sidebar Widget in WordPress

Floating elements that sticks to your screen as you scroll tend to have a higher click through and conversion rate than static objects. This is why many websites make use of floating elements through out their website. We have seen elements like header bar, footer bar, sidebar widget with newsletter optin, etc. In the past we showed you how to create a sticky floating footer bar in WordPress like we are using on WPBeginner. In this article, we will show you how to create a sticky floating sidebar widget in WordPress, so you can make your email newsletter stand out even more.

Note: This works for all type of sidebar widgets, not just your email optins. You can use it for product promotions, popular posts, flickr photosgoogle calendar, and basically anything else that you like.

Sticky sidebar floating widget demo

First thing you need to do is install and activate the Q2W3 Fixed Widget (Sticky Widget) plugin. After activating the plugin, go to Appearance » Widgets and click on the widget that you want to make sticky. The plugin adds a Fixed Widget option in all of your widgets. Check the Fixed widget box and save changes. Go to your live site and scroll down. Your fixed widget will now be a sticky floating widget.

Making a widget sticky by checking the fixed widget checkbox

Sticky Widget plugin comes with options to configure the positioning of the fixed widgets. Go to Appearance » Fixed Widget Options to configure the plugin. On this page you can set the margins, add your own HTML IDs and even disable the fixed widgets on phone and tablets.

Configuration options for sticky floating sidebar widget plugin

Sticky floating sidebar widgets can be used to boost sign ups, showcase content, and increase overall user loyalty. You can have multiple fixed widgets in a sidebar. However, these could easily get annoying and can have an adverse affect too. Keep a balance in your design, so you don’t frustrate your users.

We hope that this article helped you implement a sticky floating sidebar widget in your WordPress website. You can put a sticky footer bar, a sticky top navigation, and a sidebar widget. Which one would you rather use on your website

?

April 24th, 2013

Glossy Buttons with CSS3 Gradient

We have covered CSS3 gradients a few times, from linear gradient, radial gradient and repeating gradient. This time, we try to utilize these features to create a nice effect, which previously required using a few images for it to work.

In this post, we are going to create the glossy button effect as shown in the above screenshot using CSS3 Gradients and with simple HTML markup.

HTML Structure

As in other tutorials, we will first prepare some essential stuff and, this time, we only need this linen texture for the background. Then create an HTML document, and put the following HTML structure.

 <!DOCTYPE html> <html> <head> <title>Glossy Effect with CSS3 Gradient</title> <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="container"> <div class="glossy"> <a>Click Here</a> </div> </div> </body> </html> 

Styles

Then, we start working on the stylesheet. We start off by adding background texture in the body, specify the container width and align the text to the center, as follows.

 body { background: url('../img/ios-linen-white.jpg?new'); } .container { width: 100px; margin: 50px auto; } .glossy a { margin: 6px 0 0 0; text-align: center; display: block; width: 100%; height: 100%; text-decoration: none; color: #000; } 

Next, we add some decorative styles to the div with .glossy class, including the border radius, border color, and the gradient color. There are some handy tools to create CSS3 Gradients, such as from Colorzilla orGradientoo. Regarding this gradient color, we only mix two colors, and adjust the first color stop for 31%.

 .glossy { width: 100px; height: 25px; margin: 10px auto; position: relative; background: #94c4fe; background: -webkit-gradient(linear, left top, left bottom, color-stop(31%,#94c4fe), color-stop(100%,#d3f6fe)); background: -webkit-linear-gradient(top, #94c4fe 31%,#d3f6fe 100%); background: -moz-linear-gradient(top, #94c4fe 31%, #d3f6fe 100%); background: -o-linear-gradient(top, #94c4fe 31%,#d3f6fe 100%); background: -ms-linear-gradient(top, #94c4fe 31%,#d3f6fe 100%); background: linear-gradient(to bottom, #94c4fe 31%,#d3f6fe 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#94c4fe', endColorstr='#d3f6fe',GradientType=0 ); -webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px; border: 1px solid #4864a9; color: #000; font-size: 0.750em; text-shadow: 1px 1px 0px rgba(255,255,255,.5); -webkit-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, .2); box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, .2); position: relative; } 

At this stage, here is how it looks like.

Now, we make it more realistic by adding a shining effect on top of it, and we will add it with :before pseudo-element. Similarly, we will also add some decorative styles, like border radius and gradient colors. But, this time, we will use RGBA color format with a low Alpha channel for the background colors, as follows.

 .glossy:before { content: ""; width: 90px; height: 16px; display: block; position: absolute; left: 5px; -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px; background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0.7) 8%, rgba(255,255,255,0) 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(8%,rgba(255,255,255,0.7)), color-stop(100%,rgba(255,255,255,0))); background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0.7) 8%,rgba(255,255,255,0) 100%); background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0.7) 8%,rgba(255,255,255,0) 100%); background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0.7) 8%,rgba(255,255,255,0) 100%); background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(255,255,255,0.7) 8%,rgba(255,255,255,0) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=0 ); } 

And, at this stage, it looks much nicer.

But, as we can see, the text is slightly covered with the gradient from :before pseudo-element. So, we need to shift it higher, by specifying the z-index higher, like so.

 .glossy p { .glossy a { margin: 6px 0 0 0; text-align: center; display: block; width: 100%; height: 100%; text-decoration: none; color: #000; position: relative; z-index: 1; } 

Now, it looks much better.

You can also try with other colors. In this example, we also add another glossy effect with green. Below is the CSS codes required.

 .glossys { background: #54bc3e; background: -moz-linear-gradient(top, #54bc3e 0%, #aee850 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#54bc3e), color-stop(100%,#aee850)); background: -webkit-linear-gradient(top, #54bc3e 0%,#aee850 100%); background: -o-linear-gradient(top, #54bc3e 0%,#aee850 100%); background: -ms-linear-gradient(top, #54bc3e 0%,#aee850 100%); background: linear-gradient(to bottom, #54bc3e 0%,#aee850 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#54bc3e', endColorstr='#aee850',GradientType=0 ); border: 1px solid #1d6511; } 

Lastly, you can view the demo and download the source below.

April 22nd, 2013
Comments Off

34 Free Open Source CSS Code Snippets for Developers

With a quick Google search you will find a ton of handy CSS2/CSS3 code snippets. But what about pre-built CSS web interfaces? There are some cool widgets and samples out there, but it can be difficult finding great high-quality releases. I think developers really treasure open source codes for the fact that it saves a lot of time putting together more complicated websites.

In this showcase gallery I have organized 34 outstanding and free CSS code snippets. All of these examples provide some type of website interface element such as forms, buttons, tables, switches, pagination, and other common items. Be sure to check out the gallery listing to get a better idea of what you may be able to use in your own website(s). All items are provided by CSSFlow which you can download for free and include on any number of projects.

Glossy Buttons

bright css3 glossy buttons

Facebook Login Form

css html website login form effects input

Dark Datepicker

dark website interface date picker ui

Pricing Table

css3 html5 pricing table buttons freebie

Social Buttons

css3 social media buttons designs

Notification Windows

css3 warning windows html5 open source

Dark and Light Dropdowns

select menu lists input form dark light ui

Newsletter Signup Form

newsletter signup subscribe box effect

Dark Pagination

dark pagination ui effects website

Settings Panel

mac osx settings input panel css3 open source

Multi-colored Buttons

shiny multi-colored buttons css3 html5

Notification Badges

small css3 icons badges notify ios navigation freebie

Flip-Down Clock

static css3 clock paper effects rolodex

Share Buttons

Modal Contact Form

bright modal contact form input effects css3

Notepaper Blockquote

css3 notepaper block quote effect

Toggle Switches

pure css3 user input toggle switches open source

Metal Progress Bar

metal progress bar ui html5 css3 freebie

OSX-Style Window

transparent mac osx window made using css3 html5

Search Dropdown

search input dropdown menu suggested open source

Mini Social App

mini twitter social app ui interface css3 freebie

Month Picker

css3 generated input freebie month selection

Animated Progress Bar

css3 animated progress bar interface ui

Inset Side Navigation

inset side navigation effects freebie open source

Login Form

cssflow freebie snippet login form css3 html5 download

Dark Navigation

horizontal dark navigation tabs menu links

Light Horizontal Nav

light horizontal navigation bar tabs links freebie open source

Dark Horizontal Nav

dark block buttons navigation links css3 html5

Animated Profile Popover

user profile features popover hover effects open source

3D Buttons

html css3 3-d buttons freebie download codes

Sliding Tags

sliding blog tags posts count number jquery css3

Accordion Menu

vertical html5 css3 accordion menu interface design

Tabbed Navigation

css3 tabbed navigation toolbar effects design

Mini Dropdown Menu

dark dropdown menu css3 mini effects ui

April 18th, 2012

40 Examples of Brilliant Responsive Website Layouts

Responsive web design become a very popular trend in 2011. It’s likely something we’ll see continuing well into 2012 as designers are beginning to support a myriad of mobile devices. Building layouts for the web can be tough, but inspiration is a huge factor.

In this gallery I’ve collected 40+ amazing responsive website layouts. These designs are built to support a set of different resolutions and re-size accordingly. It’s tricky building this functionality in HTML5, even advanced web developers may not understand responsive design trends. But check out some of our examples below and you’ll pick up techniques very quickly. Additionally let us know your thoughts or questions in the post discussion area.

Fork CMS

Full View:

Mobile View:

SimpleBits

Full View:

Mobile View:

White Lotus Aromatics

Full View:

Mobile View:

1140px CSS Grid

Full View:

Mobile View:

Atlason

Full View:

Mobile View:

10K Apart

Full View:

Mobile View:

Cognition

Full View:

Mobile View:

Reverse Buro

Full View:

Mobile View:

Sunday Best

Full View:

Mobile View:

Dustin Senos

Full View:

Mobile View:

Clear Air Challenge

Full View:

Mobile View:

Owltastic

Full View:

Mobile View:

320 and up

Full View:

Mobile View:

Yaron Schoen

Full View:

Mobile View:

Build Guild

Full View:

Mobile View:

Do Lectures

Full View:

Mobile View:

Trent Walton

Full View:

Mobile View:

Food Sense

Full View:

Mobile View:

Sparkbox

Full View:

Mobile View:

ribot

Full View:

Mobile View:

Sweet Hat Club

Full View:

Mobile View:

A Different Design

Full View:

Mobile View:

Teixido

Full View:

Mobile View:

Sasquatch Music Festival

Full View:

Mobile View:

Electric Pulp

Full View:

Mobile View:

Stephen Caver

Full View:

Mobile View:

Social Marketer’s Summit

Full View:

Mobile View:

Sleepstreet

Full View:

Mobile View:

Porcupine

Full View:

Mobile View:

Interim

Full View:

Mobile View:

Tileables

Full View:

Mobile View:

CalebAcuity

Full View:

Mobile View:

Simon Collison

Full View:

Mobile View:

Spigot Design

Full View:

Mobile View:

Forefathers Group

Full View:

Mobile View:

Deren Keskin

Full View:

Mobile View:

Robot… Or Not?

Full View:

Mobile View:

Arrrcamp Conference

Full View:

Mobile View:

Thirst Studios

Full View:

Mobile View:

Visua Design

Full View:

Mobile View:

Made by Splendid

Full View:

Mobile View:

Five Simple Steps

Full View:

Mobile View:

Ryan O’Rourke

Full View:

Mobile View:

dConstruct 2011

Full View:

Mobile View:

Diablo Media

Full View:

Mobile View:

Asbury Agile Web Conference

Full View:

Mobile View:

January 26th, 2011

Transparency in Web Design

How is it done? Let’s take a gander at four different ways. Each of them handling the illusion in a different way, and each completely appropriate depending on the situation at hand.

Totally Friggin Fake It


From the Spectrum Theme website

The end result of any web design is basically an illusion anyway. You can always create your transparent effects in Photoshop or whatever other graphics editor and export flat graphics. In Photoshop, transparent effects can be created by changing a layers opacity level, fill level, or blending mode, just to name a few.

Opacity


This entire button has opacity applied to it, to emphasize that it is currently “disabled”.

You can make any element transparent by using the opacity parameter of CSS.

#anything { opacity: 0.5;  /* 50% transparent */ }

If you need to support older browsers, see here.

Do note that all descendants of the element with opacity also become transparent. There is no way to “force” any descendant to be come any less transparent as the parent is.

RGBa / HSLa


From the Like Architects site

Using RGBa for a color value in CSS, you can set a transparency level on any color. This has the distinct advantage over opacity in that it doesn’t have any affect on descendants. It is also nice in that creating faded out variations of a color is as easy as changing the final alpha value. Speaking of color variations, that is even easier to do with HSLa, and is still able to handle transparency.

#anything { background: rgba(0,0,0,0.5);  /* 50% transparent */ }
#anything { background: hsla(0,0,0,0.5);  /* 50% transparent */ }

PNG


From a Dribbble

When “Saving for web” from Photoshop, you have two choices for PNG’s: PNG-8 and PNG-24. PNG-8 is like a GIF in that you can have transparency in pixels, but a pixel is either fully transparent or fully opaque, no in-between. PNG-24’s, while far bigger in file size, support full alpha-transparency.

In the example above, the shadows from the content areas are from PNG-24s so that the texture in the background can change and the shadows will still be the same.

May 31st, 2010

Tricks

Drag things, pick colors, make a nice class for your buttons… introducing the Button Maker.


Boy, that’s a nice button right there.

I’m saying “CSS3″, because these make use of gradients, shadows, and rounded corners which contribute greatly to their button-ness. In older browers that don’t support these properties, the fallback is solid-color background, no shadows, and square corners. Not a big deal.

I hope this is painfully obvious, but to use this Button Maker thing, you just adjust the settings until you have a nice looking button, then press the button and it will give you the CSS. Copy and paste at your leisure. Now you can use the class name “button” on HTML elements to make them look like buttons. The CSS isn’t formatted real pretty. If someone has an idea on how to make that better, please do let me know.

The super-awesome empowering concept…

…in regards to how the Button Maker preview works.

It’s easy to change the CSS of an element on-the-fly with JavaScript. But how can we change the :hover state? The answer is that we can’t really, at least not really easily. We could attach a mouseenter event that would apply some new CSS that would override the old, and a mouseleave event that would put it back. That’s a lot of overhead for something so relatively small. It gets even more complicated if we wanted to control the :active state as well.

This Button Maker shows you a live working version of the button you create, complete with :hover and :active states. It is done without attaching any JavaScript events to the button itself. So how is it done? I did it with a technique I ripped off from Doug Neiner who presented it (as small part of a totally different application) at jQConf.

OK OK I’ll get on with it. The idea is to append a <style> element into the <head> which overrides the existing CSS (in-document CSS automatically overrides linked CSS for selectors with the same specificity value). Then when something changes, you literally rip the whole style tag out, and replace it.

Appending a new style:

$("head").append("<style type='text/css'></style>");

Text variable where the CSS will be kept. Keep this text up to date when options change.

var cssText = "";

Use the replaceWith() function to rip out existing style element and apply a new one:

$("style").replaceWith("<style type='text/css'>" + cssText + "</style>");

The ripping-out part is important. Originally I tried putting an ID on the style element and replacing the content within it on the fly. It did replace the content, but those changes were not reflected on the page. Apparently in order to force the browser to re-render with the new CSS, you have to literally remove it and put it back.

Take it, shake it

I’ll provide the source for the thing in case you want to run it locally for whatever reason. Or even better, because you want to make it cooler. If you do, please share.

View Demo   Download Files

May 7th, 2010

Tricks

I’ve added two new buttons to all of the code snippets in the Snippets section of the site. Now a button to add directly to Snippets.app and a button to directly copy to the clipboard join the Coda and Textmate buttons.

Read on for some more details about them, and remember, you can help the Snippets section grow by submitting yours.

Snippets.app button


One-click adding to Snippets.app

Snippets.app supports a URL protocol thingy. That is, once the application installed, browsers on your system know that when a URL is entered that begins with “snippets:” (instead of like http://) that it should launch (or ask you to launch) Snippets.app and do something with that URL.

Their format is:

snippets:add?code=[ENCODED-CODE-HERE]&name=[SNIPPET-NAME]&relatedurl=[REFERENCE-URL]&author=[AUTHOR-NAME]

You’ll only see this once if you check the box.

Since all my code snippets are in <pre> elements, this is how I add the Snippets.app button to each code block (simplified):

$("pre").each(function() { $preblock = $(this); $codeblock = $preblock.find("code"); $snippets_link = "snippet:add?code=" + encodeURIComponent($codeblock.text()) + "&name=" + $title + "&relatedurl=" + encodeURIComponent(document.location.href); $("<a class='snippet-button'>Add to Snippets.app</a>").attr("href",$snippets_link).appendTo($preblock); });

Copy to Clipboard

This button is powered by the awesome Zero Clipboard. For a while after Flash 10 came out, copying to clipboard from the web was borked as Flash 10 had some new security restrictions that blocked the previous methods (Yeah, apparently Flash is needed to have this work correctly). Zero Clipboard stepped it up and fixed it somehow.


One-click copying to clipboard

One particular challenge here was with the rollover technique I’m using to display the “tooltip” like text for each button. On the three other buttons, I do a simple thing where I append a span to the anchor link on hover, and remove it on the hover callback:

$(".snippet-button").hover(function() { $el = $(this); $el.append("<span>" + $el.text() + "</span>"); }, function() { $(this).find("span").remove(); });

The span is styled and positioned with CSS.

The problem is, Zero Clipboard works by positioning a completely transparent flash embed over top of the button. This means there is no traditional hover even fired when the mouse goes over this area. Fortunately, Zero Clipboard provides event listeners which you can have fire callback functions for you. See the last two lines:

ZeroClipboard.setMoviePath( '/path/to/ZeroClipboard.swf' );

$(".copy-clip").each(function(i) {

clip = new ZeroClipboard.Client();

$el = $(this); $parent = $el.parent();

clip.glue($el[0], $parent[0]);

txt = $el.parent().find("code").text(); clip.setText(txt);

clip.addEventListener('complete', function(client, text) { // provide some user feedback of success });

clip.addEventListener('mouseOver', copyMouseOver); clip.addEventListener('mouseOut', copyMouseOut);

});

Those two functions, copyMouseOver and copyMouseOut are used to do the same span-applying-and-removing business the other buttons use. The one tricky-dick thing left is that these functions need to know which parent element to deal with, in the case of multiple snippets on a single page. Fortunately they automatically pass the object to the function which is loaded with info about that element, including the ID, which I use to specify which code snippet button we are talking about:

function copyMouseOver(passed) { $("#copy-" + passed.id).append("<span>Copy to Clipboard</span>"); };

I wanted to make sure there was a bit of user feedback when a clip was successfully copied to the clipboard, so you’ll notice that the clip itself quickly fades down and back up after a successful copy. Somewhat subtle but I think it’s fairly satisfying.

Coda and TextMate

Not much has changed here. I covered how to add Coda buttons in a previous tutorial. David Walsh covered the TextMate button, which requires some fancy server side action.

Seem to work OK?

Give it a test and let me know… I’ve heard some musings of FAIL on Twitter but all the buttons seem to work OK for me. If you want to do a FAIL report, please attempt to be helpful and explain which button isn’t working, the browser/version/platform, and what actually happens.

Macity Mac Mac Mac

Yeah all the integrations are Mac software. Sorry about that, that’s just how I roll. If there was a PC program that supported a URL protocol thingy, I’d check it out and see what I could do about integrating it. For now, the copy to clipboard thing should be useful still.

Media Fusion

Multiple Login Forms with Highlighting

Posted: 23 Feb 2010 05:12 AM PST

This is a little specific… but I figured what the heck maybe it will be useful for someone. I recently had occasion to make multiple different login forms on a single page. With CSS we know we can apply styling to active inputs with :active. That’s useful… and we’ve covered how to do both input and label highlighting before. But now we need go one step up and highlight the current form itself.

continue reading…

May 6th, 2010

Tricks

This is an update to original Chat Room we published here on CSS-Tricks. In some ways, the technology is the same. We are going to employ PHP to talk to the server, jQuery to keep the chat rolling, and the chats themselves will be stored in .txt files just like the first version.

What is changed is the addition of some new features:

  • Usernames are unique to users currently chatting
  • You can see a “currently chatting” user list
  • There are multiple rooms for chatting

 

A Little MySQL

While the first version of this used no database at all, we are going to employ a little MySQL for this version. There is a file in the download called Setup.sql for use in building the initial database. MySQL isn’t for the chats themselves, but for two other things:

  • Keeping track of active users
  • The rooms

When someone comes in to chat, they choose a username. Using some jQuery, it makes an AJAX request to see if that username is currently in use in the database. If it is in use, you get a warning:

Otherwise, it says it’s cool:

If it is cool, and you click to join the chats, that username will be put into the database and thus further checks for it’s name will tell others that name is unavailable. Idle users are removed from the database.

Adding/Editing/Removing Rooms

The names of the chatrooms are kept in the database. To add a new chatroom, just add a new row to the database with the name of the chatroom and the filename of the text file you intend to store the chat:

Then it’s just a matter of making sure the text file is on the server in the right place with proper server-writeable file permissions (see the download for properly location).

jQuery

I’m sure you’ve noticed by now we haven’t been looking at any actual code. This is on purpose. All the code is available in the download (see below). It is not so incredibly much that it’s overwhelming, but I think it’s too much for a standard written tutorial/overview. Instead, let’s overview what it’s responsible for:

Username checking: On the homepage of the chat, when you choose your username, jQuery is there watching that text input. When you type a character (on keyup) it asks a certain PHP file (via AJAX) if that username is in use. The PHP file responds with a yes or no, and a message is appended to the screen accordingly.

Message box: When a user types into the textarea for sending a message, the jQuery watches that box and ensures the text is under a certain number of characters (set via maxlength attribute on the textarea)

Sending message: When the return/enter key is pressed in the chat box the value of it is sent for processing. PHP writes the text to the text file.

Updating the chat: Every few seconds, jQuery asks a PHP file to poll the text file to see if there are any new lines, if there are, they are displayed.

Features it doesn’t have

  • You can’t kick people out
  • It doesn’t do special characters

You wanna add that stuff in? I’d love it and I’ll update this.

Demo and Download

View Demo   Download Files

FAIR WARNING: Anonymity on the internet brings out the absolute worst in people. I want to keep a live demo for this on the site because it’s fun to play with and so you can all check it out. But I guarantee that people are going to abuse it. There will be foul words, porn, and probably even some unbelievable racism. Believe me, I’d like to knock these people down and put out a cigar in their eyeball as much as you do, but hey, whattayagonnado?

Credits

Special thanks to Kenrick Beckett who created the original code that powered this and Jason Lengstorf for looking it over and tidying some things up security-wise.

March 17th, 2010

Create a CSS3 Button That Degrades Nicely

There was a time where creating a nice looking, scalable button required heavy use of images, the sliding doors technique and even some javascript. As it stands a lot of the modern browsers support the css we would like to use to create a nice looking button. Firefox, Safari and Opera all have support for rounder corners, box shadows and text shadows. What used to take six steps and lots of extra mark-up, images and css, now only takes three steps and some simple CSS3.

One of the great perks regarding this technique is that in the event that a user doesn't have a browser that supports the CSS that we will be using, they will still see a nice beveled button – it simply won't look quite as nice.

What We are Going To Do

To create a nice button we have a few major components:

  • A nice background gradient
  • Rounder corners
  • Some nice borders to give it a 3D effect
  • A drop shadow
  • A text shadow (for a nice touch)

In the end we will have a button that looks just like this, only with out using any images behind a few pixel background gradient (and when CSS gradients are supported we can even remove that!).

screenshot

The HTML

 <p><a href="#">Example Button</a></p> <p><a href="#">Example Button</a></p> <p><a href="#">Example Button</a></p>

As you can see the HTML is very basic, we essentially just need an anchor tag and text. The paragraph is there just to be semantic.

The CSS

 .css3button a { background: url(background.gif) bottom repeat-x #9eabb3; padding: 5px 10px 5px 10px; text-align: center; font-weight: bold; color: #fff; text-decoration: none; border: 1px inset #aaa; -webkit-border-radius: 8px; width: auto; -moz-border-radius: 8px;
-khtml-border-radius: 8px; border-radius: 8px; -moz-box-shadow: 1px 1px 1px #666; -webkit-box-shadow: 1px 1px 1px #666;
box-shadow: 1px 1px 1px #666; text-shadow: rgba(0,0,0, .5) 0px -1px 0px;
border-top: inset 1px #ccc; border-left: inset 1px #ccc;
border-bottom: solid 1px solid #000; border-right: 1px solid #666; } .css3button a:hover { background: #999; text-shadow: rgba(0,0,0, .5) 0px 1px 0px; }

The CSS is a bit more complicated, but still fairly simple. We are really just adding a repeating background image, adding some rounded corners, as well as box and text shadows. The borders add a bit more depth / shading and ensures that if the CSS properties are not supported that the element still retains a beveled appearance.

background

The background image is simple gradient to give the button some depth, in this case I used the following image:

That Simple

That is how easy it is. If you want to play around with the borders you can end up with some pretty nice effects as well.

More Examples