Feeds:
Posts
Comments

Archive for the ‘CSS Hacks’ Category

The AcidJs.Reflections class is an enabler for CSS3 image reflections, written in JavaScript and using jQuery (but can be easily ported to use pure JavaScript). It does not rely on the experimental box-reflect property, but rather on CSS3 transforms and gradients (for IE9 it’s using the proprietary gradient filter with alpha channel).

reflections

The class works with all major browsers, including Internet Explorer 9 and 10, and does not initialize on older versions. Check the demo and implementation and eventually download it from my JavaScript, CSS3 and HTML5 experiments website.

Related Posts

Read Full Post »

The post for today is not something really special or super amazing. It’s just a quick and dirty trick that I use when I have to create inline forms for selecting files in which the actual input is hidden, and users click some text node (link, button, etc) that opens the browse for file dialog, which I wanted to share with you.

The Markup:

<div class="css3-inline-file-input">
    <form action="./" enctype="multipart/form-data" method="post" name="form-01">
        <input type="file" accept="image/jpg, image/jpeg, image/gif, image/png, image/bmp" name="form-01-file" /><span>Choose File</span>
    </form>
</div>

The CSS:

.css3-inline-file-input,
.css3-inline-file-input *
{
    display: inline-block;
}

.css3-inline-file-input *
{
    margin: 0;
    padding: 0;
    border: 0;
}

.css3-inline-file-input form
{
    position: relative;
}

.css3-inline-file-input input
{
    position: absolute;
    right: 0;
    cursor: pointer;

    filter: alpha(opacity=0); /* opacity fix IE6/7/8 */
    -moz-opacity: 0; /* opacity fix for older Firefox */
    -webkit-opacity: 0 /* opacity fix for older Chrome */;
    opacity: 0;
}

.css3-inline-file-input
{
    width: auto;
    vertical-align: top;
    overflow: hidden;
}

.css3-inline-file-input span
{
    display: block;
    text-align: center;
    text-decoration: underline;
}

.css3-inline-file-input input:hover + span
{
    text-decoration: none;
}

/* fixes for IE6/7 */
* html .css3-inline-file-input,
* html .css3-inline-file-input *,
* + html .css3-inline-file-input,
* + html .css3-inline-file-input *
{
    display: inline;
}

Older versions of Internet Explorer do not fire the onchange event on elements, hidden with CSS display: none or visibility: hidden, but instead an exception is thrown. This is why I used opacity: 0 and position: absolute to hide he original input.

You can check the demo on this page, and in case you find it useful, you can download it here.

Enjoy the rest of the day!

Related Posts

Read Full Post »

HTML5.CV is a resume generator and one pager website, with cool modern looks, various customization options and flexible resume data file. You can add any fields (contact details, employment history, education, interests, etc) and define photo.

The UI is extremely easy to customize, so if you are acquainted with CSS, just give it a try or download it straight away.

html-5-cv

Key Features

  • Lightweight, modern and loading extremely fast.
  • CSS3 driven with fallback for older browsers.
  • Cross-platform JSON data format for the resume.
  • Support for multiple resume data files.
  • Operating fully on the client.
  • Sleek imageless UI, which can be easily modified.

Related Posts

Read Full Post »

If you are looking for cool development and productivity tools, here are a few, created by me, and available as handy Chrome Chrome extensions:

Builder.CSS

Builder.CSS is a free tool for merging and minifying style sheets into a single file, using some of the coolest HTML5 features like drag and drop of local files and processing them without uploading to the server. I am happy to announce that recently Builder.CSS has evolved to a free online service with tons of improvements, brand-new and amazing interface, drag and drop of local of styleshets from the desktop, predefined projects and much more. Get the Chrome extension or click here for more info and demo.

builder-css

W3C Validation Bookmarklet

Acid.JS Validator is a free bookmarklet that uses the W3C SGML parser’s API to validate the markup of the page on which it is called. Get the Chrome extension or click here for more info and demo.

validator-valid

Stickeez

Stickeez is a sticky notes JavaScript application using the new HTML5 File API, localStorage and CSS3. The data is fully persisted on the client. Stickeez also has an option for importing/exporting data so users can save their notes before cleaning up cookies or import notes to another browser. And finally – users can choose between 4 types of board styles – cork, fridge, whiteboard and skulls. Get the Chrome extension or click here for more info and demo.

stickeez

Image to Base-64 Data-URI Encoder

Image2Base64 is an online tool, provided by Acid.JS Web.UI for conversion of image files to base64 data URIs. It implements the new HTML5 file API, and the selected images are processed entirely on the client without uploading them onto the server. Get the Chrome extension or click here for more info and demo.

image-to-base-64

Hasher Message Digest Encoder

Hasher is an online service for creating message digests with a wide range of more than 40 encryption algorithms. Depending on the choice of the user, after the encryption hashes are stored in the browser’s local storage in convenient JSON format so they can be used or deleted later. Get the Chrome extension or click here for more info and demo.

hasher

Read Full Post »

I’ve just finished another cool HTML5, CSS3 and JavaScript example – the Charts class. It’s not canvas, because I don’t care about canvas – just good old HTML5 and CSS3 and a bit of JavaScript for processing the charts data. Make sure you check it here and enjoy the day! In case you like it, you may want to download it or maybe check other cool dev experiments.

charts

Read Full Post »

I am pleased to announce that I’ve just finished my latest endeavour – HTML5, CSS3 and JavaScript Experiments and Insight, and most of the code samples and demos from my blog have been moved there in and new and convenient code-listing and demo form. From now on, each new blog post will be accompanied by a dedicated page on that website on which my readers will be able to have a look at the code, run the example and eventually download it.

Enjoy HTML5, CSS3 and JavaScript Experiments and Insight and have a great rest of the week!

Read Full Post »

This is an experiment, demonstrating that you can create cool slide viewer functionality without a single line of JavaScript, but only by the means of CSS3 and HTML5.

Watch this presentation to learn how it’s done and what makes it so cool. If you don’t feel like reading, just check the demo or download CSS3 Slides Viewer right away.

The HTML:

…Is a simple <form /> and a radio button list:

<div class="css3-slides-viewer">
    <form name="css3-slides-viewer" method="post" action="./">
        <fieldset>
            <legend>CSS3 Slides Viewer</legend>
            <ul>
                <li><input type="radio" name="css3-slides-viewer-slides" autofocus="autofocus" id="slides-00" checked="checked" />
                    <label for="slides-00"><!-- / --></label>
                    <section>
                        <!-- slide content should go here -->
                    </section>
                </li><li><input type="radio" name="css3-slides-viewer-slides" id="slides-01" />
                    <label for="slides-01"><!-- / --></label>
                    <section>
                        <!-- slide content should go here -->
                    </section>
                </li>
            </ul>
        </fieldset>
    </form>
</div>

The Slides Counter…

… Has been implemented via CSS counters:

.css3-slides-viewer > form > fieldset > ul > li section::before
{
    counter-increment: slide;
    content: "Slide " counter(slide);
}

The Fade-in/out Animation…

… Is using delayed CSS3 transitions and visibility: visible/hidden.

.css3-slides-viewer > form > fieldset > ul > li > section
{
    transition: all 500ms 10ms ease-in;
}

Hide/Show Slides

/* by default slides are hidden */
.css3-slides-viewer > form > fieldset > ul > li > section
{
    visibility: hidden;
}

/* the slide is visible only if it's radio button is selected */
.css3-slides-viewer > form > fieldset > ul > li > input:checked ~ section
{
    visibility: visible;
}

Supported Browsers

Mozilla Firefox, Google Chrome, Apple Safari, Opera, nternet Explorer 9+

Due to the lack of support for CSS transitions, Internet Explorer 9 does not play the fade-in/out animation, and enabling the keyboard navigation should be done by clicking the buttons on top, because that browser does not support the autofocus=”autofocus” property of HTML5.

Check the demo or download CSS3 Slides Viewer.

If you like this solution, you can also check my personal wesbite, Acid.JS Web.UI, my blog or follow me on Twitter.

Make sure you try my online CSS minifier and merger and image to base-64 encoder.

Related Posts

Read Full Post »

I am happy to announce that one of Acid.JS‘s most successful widgets, Builder.CSS has evolved to a free online service with tons of improvements, brand-new and amazing interface, drag and drop of local of styleshets from the desktop, predefined projects and much more. Builder.CSS is a free tool for merging and minifying style sheets into a single file. You can use it along with our Image2Base64 Encoder, Builder.JS and RESTBuilder tools.

Just give it a try on it’s new home page. Optionally, it is available for hosting on your own domain – if you are interested, please, check the Help & About tab of Builder.CSS.

builder-css

Features and Improvements

  • New and cool looks with easy and intuitive UI.
  • Brand-new optimization routine, crunching your CSS even more at the speed of light.
  • Support for predefined projects, which can contain the styles of all your websites (self-hosted version only).
  • Add files from desktop via drag and drop.
  • View, exclude and remove files from compilation.
  • Processing is done entirely in the browser.
  • Option to save the ouput to a file on the server (self-hosted version only).
  • … And much more, just try it here.

Screenshots

Related

Read Full Post »

I am not a huge fan of roundups, but this morning, I found that I have a few pretty popular CSS3 posts and decided to put them in a single post which will be updated whenever a new one appears and is worth seeing.

How to Create a Fully Functional CSS3-only Treeview

css-3-treeview

How to Create a Fully Functional CSS3-only Tabstrip without a Single Line of JavaScript

css3-tabstrip

How to Create Semantically Correct Imageless Custom Checkboxes and Radiobuttons with CSS3

css-pages-imageless-css3-custom-checkboxes-and-radio-buttons

How to Style HTML Dropdowns with CSS3

selectbox

Creating Crossbrowser CSS3 and SVG Reflections

css3-element-reflections

How to Create iPhone Toggle Buttons with CSS3

iPhone

How to Achieve Gaussian Blur Effect with CSS3

gaussian-02

CSS3 Driven Slides Viewer Without any JavaScript

Just check this amazing presentation here.

How to Create Fancy Animated Tooltips without any JavaScript

Download CSS3 Tooltip

How to Crop Background Sprite with CSS3

css3-background-image-cropping

Read Full Post »

The code for today is a fully functional CSS3-only tabstrip, which works without a single line of JavaScript and natively supports keyboard arrow navigation. If you don’t feel like reading the explanations that follow, you can download the example straight away.

css3-tabstrip

The CSS

In short – we have a list with radio buttons, <label />s and <div />s. We hide each <div />, which is the content of the tab according to the checked state of the radio button. The <label /> is used as the button of the tab.

/*
 * @CSS3 Tabstrip
 * @author Martin Ivanov
 * @website http://wemakesites.net
 * @blog http://acidmartin.wordpress.com/
 * @twitter https://twitter.com/wemakesitesnet
 **/

.css3-tabstrip ul,
.css3-tabstrip li
{
    margin: 0;
    padding: 0;
    list-style: none;
}

.css3-tabstrip,
.css3-tabstrip input[type="radio"]:checked + label
{
    position: relative;
}

.css3-tabstrip li,
.css3-tabstrip input[type="radio"] + label
{
    display: inline-block;
}

.css3-tabstrip li > div,
.css3-tabstrip input[type="radio"]
{
    position: absolute;
}

.css3-tabstrip li > div,
.css3-tabstrip input[type="radio"] + label
{
    border: solid 1px #ccc;
}

.css3-tabstrip
{
    font: normal 11px Arial, Sans-serif;
    color: #404040;
}

.css3-tabstrip li
{
    vertical-align: top;
}

.css3-tabstrip li:first-child
{
    margin-left: 8px;
}

.css3-tabstrip li > div
{
    top: 33px;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px;
    overflow: auto;
    background: #fff;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.css3-tabstrip input[type="radio"] + label
{
    margin: 0 2px 0 0;
    padding: 0 18px;
    line-height: 32px;
    background: #f1f1f1;
    text-align: center;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

.css3-tabstrip input[type="radio"]:checked + label
{
    z-index: 1;
    background: #fff;
    border-bottom-color: #fff;
    cursor: default;
}

.css3-tabstrip input[type="radio"]
{
    opacity: 0;
}

.css3-tabstrip input[type="radio"] ~ div
{
    display: none;
}

.css3-tabstrip input[type="radio"]:checked:not(:disabled) ~ div
{
    display: block;
}

.css3-tabstrip input[type="radio"]:disabled + label
{
    opacity: .5;
    cursor: no-drop;
}

The Markup

In the example below, the first tab is selected by default, because the radio button, associated with it has the checked attribute. You can set arbitrary tab to selected by default like that.

<div class="css3-tabstrip">
    <ul>
        <li>
            <input type="radio" name="css3-tabstrip-0" checked="checked" id="css3-tabstrip-0-0" /><label for="css3-tabstrip-0-0">Home</label>
            <div>
                <h3>What is Lorem Ipsum</h3>
                <p>Lorem Ipsum is simply dummy text of the printing and
                    typesetting industry. Lorem Ipsum has been the industry's
                    standard dummy text ever since the 1500s, when an unknown
                    printer took a galley of type and scrambled it to make a
                    type specimen book. It has survived not only five centuries,
                    but also the leap into electronic typesetting, remaining
                    essentially unchanged. It was popularised in the 1960s
                    with the release of Letraset sheets containing Lorem
                    Ipsum passages, and more recently with desktop publishing
                    software like Aldus PageMaker including
                    versions of Lorem Ipsum.</p>
            </div>
        </li><li>
            <input type="radio" name="css3-tabstrip-0" id="css3-tabstrip-0-1" /><label for="css3-tabstrip-0-1">About Us</label>
            <div>
                <h3>Why do we use it?</h3>
                <p>It is a long established fact that a reader will be distracted
                    by the readable content of a page when looking at its layout.
                    The point of using Lorem Ipsum is that it has a more-or-less
                    normal distribution of letters, as opposed to using 'Content
                    here, content here', making it look like readable English.
                    Many desktop publishing packages and web page editors
                    now use Lorem Ipsum as their default model text, and a
                    search for 'lorem ipsum' will uncover many web sites still
                    in their infancy. Various versions have evolved over the
                    years, sometimes by accident, sometimes on purpose
                    (injected humour and the like).</p>
            </div>
        </li><li>
            <input type="radio" name="css3-tabstrip-0" id="css3-tabstrip-0-2" /><label for="css3-tabstrip-0-2">Portfolio</label>
            <div>
                <h3>Where does it come from?</h3>
                <p>Contrary to popular belief, Lorem Ipsum is not simply
                    random text. It has roots in a piece of classical
                    Latin literature from 45 BC, making it over 2000 years
                    old. Richard McClintock, a Latin professor at Hampden-Sydney
                    College in Virginia, looked up one of the more obscure
                    Latin words, consectetur, from a Lorem Ipsum passage,
                    and going through the cites of the word in classical
                    literature, discovered the undoubtable source. Lorem
                    Ipsum comes from sections 1.10.32 and 1.10.33 of "de
                    Finibus Bonorum et Malorum" (The Extremes of Good and Evil)
                    by Cicero, written in 45 BC. This book is a treatise on
                    the theory of ethics, very popular during the Renaissance.
                    The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..",
                    comes from a line in section 1.10.32.</p>
            </div>
        </li><li>
            <input type="radio" name="css3-tabstrip-0" id="css3-tabstrip-0-3" disabled="disabled" /><label for="css3-tabstrip-0-3">Contact Us</label>
            <div>
                <h3>Where can I get some?</h3>
                <p>There are many variations of passages of Lorem Ipsum available,
                    but the majority have suffered alteration in some form,
                    by injected humour, or randomised words which don't look
                    even slightly believable. If you are going to use a
                    passage of Lorem Ipsum, you need to be sure there isn't
                    anything embarrassing hidden in the middle of text. All
                    the Lorem Ipsum generators on the Internet tend to
                    repeat predefined chunks as necessary, making this the
                    first true generator on the Internet. It uses a dictionary
                    of over 200 Latin words, combined with a handful of model
                    sentence structures, to generate Lorem Ipsum which looks
                    reasonable. The generated Lorem Ipsum is therefore
                    always free from repetition, injected humour, or
                    non-characteristic words etc.</p>
            </div>
        </li>
    </ul>
</div>

Finishing Touches

What’s left is to set width and height to the tabstrip. This should be done on the outermost element. If you have different tabstrips on the same page, you can use it’s, secondary classes, etc. In the example page, we have just one tabstrip, so we will use the base class:

.css3-tabstrip
{
    width: 440px;
    height: 220px;
}

Supported Browsers

  • Mozilla Firefox
  • Google Chrome
  • Apple Safari
  • Opera
  • Internet Explorer 9 and above

If you like this post, maybe you will follow me on Twitter or visit my personal website for other cool stuff. You can also try out the demo or download the example from this link.

Enjoy the weekend!

Related Posts

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 474 other followers

%d bloggers like this: