Tag Archives: HTML5

Changing the font-style of placeholder text CSS

Note: This post could also be called, why I am an idiot and need to look for simple answers.

I needed to make my placeholder text italic in a project I was working on recently.

Initially I figured because this is a relatively new HTML5 attribute the CSS is probably going to involve some crazy CSS vendor prefixes, and the first path I went down confirmed this.

To change the colour of your placeholder text you need to use something like input:-moz-placeholder {color:red;} so I figured I would stick in input:-moz-placeholder {font-style: italic}, this didn’t work and I couldn’t figure why – obviously vendor prefixed solutions are never 100% and I initially started looking to double check Mozilla hadn’t ripped this out or replaced it in newer versions of FireFox.

Then it dawned on me that it probably inherits some properties from its parent (input), so the change turned out to be incredibly simple: input {font-style:italic} did the trick.

There are two reasons why I didn’t immediately come up with this solution.

  1. In my head I had already started over-complicating it.
  2. The designs presented to me had only placeholder text, so I wasn’t thinking about how to style the input, just how to style the placeholder.

My lesson here is to not over think things too early on, try and find the simple solution first.

Share this on

The EU Cookie Law website

So over the weekend I launched The EU Cookie Law.com, there are several firsts for me and interesting features that I wanted to discuss.

So the reason I decided to create this site was because I wanted to learn more about the law and how it applies to the projects I work on.

Initially I was going to write an in-depth blog post about it but then decided to use it as an excuse to play with some funky new toys I have been meaning to play with for a while.

Learning about the law

Even the process of learning about the law was pretty interesting – on a quick pass you find a handful of websites aimed at the law and a few articles on it, but nothing major – but if you start to refine your search you find that there are hundreds of people chatting about it and there are a lot of conflicting views – it really depended on how you worded your search .

There is a question here around how neutral you can make yourself whenever you search on the web, the tone of question could very well dictate the type of answer, but that is for another blog post.

This project was the first time in a long time that I set myself a homework – normally I skim read dozens of articles, follow a handful of tutorials and generally coast through new things (I strongly believe this to be the most efficient way to be an excellent generalist).

This time I gave myself the task of learning about something in depth, writing notes on it and then summarising those notes in a way I felt would be useful to others.

I really enjoyed the process and I certainly think I am going to set myself more tasks like this – instead of maybe just following a tutorial, really getting my teeth into each section and writing about it in a longer form format.

The final takeaway point for learning about the law was the law itself, it seriously sucks, if you want to know about the EU Cookie Law, naturally you should visit the site but essentially it is just a bollocks law set by people who clearly have no real grasp of the technical issues involved in policing or enforcing something like this – it will crush small/medium businesses and put European trade on the back foot. Complete rubbish.

Technology

So the reason I decided to make a site instead of writing a blog post was I wanted a reason to try out Twitter’s Bootstrap – just to see if it was any good. Honestly, I found it confusing as hell – I can see the use as a bit of a quick template to get you going but the experience wasn’t anywhere close to what I assumed it would be like. I wouldn’t recommend it.

Whilst I was looking through the source of the Bootstrap I was reminded though of LESS, which extends CSS to allow it to do a whole manner of awesome things – LESS is just the bee’s knees, you can add variables to your code and apply mathematical and graphic methods to them, for example you can darken a colour by a particular percentage, this is so freakin awesome and time saving you wouldn’t believe.

I was worried it would be a bit of an arse to set up because I was developing on a machine that I haven’t really had the time to set up yet – to be able to compile the LESS files down to CSS I needed to install a node package, to install a node package I needed to install node, to install node I needed to install homebrew and to install homebrew I needed to install Xcode. None of these steps was particularly hard to do, it was just annoying to have to do them!

Once all the dependancies were installed I was flying, there was even a build package already built for Sublime Text 2 (my current text editor of choice) So I can just type cmd+b to save my less file as a CSS file.

If you have been to the site you will see that it is very basic – it is really just one long article – I had decided to use HTML5 because frankly only the elderly are still writing in HTML < 5, because there was nothing too fancy going on I didn’t bother including modernizr.js and my tests showed that IE7 handled everything just fine, which is more proof (if proof be needed) that HTML5  should be the standard doctype for your markup.

I also used this project as an excuse to dick around with responsive design – before you get too excited the site doesn’t do a massive pile, in fact it was designed to be flexible regardless of media queries, but I was able to write enough to get my head more around the concepts better than it had been before.

If you are looking and can’t see it, it is because it is that subtle, basically the gutters of the page decrease away to almost nothing when viewing it on a very narrow screen.

Analytics

One of the contentious issues around the EU Cookie Law is that analytics such as Google Analytics is not seen as core site functionality, and as such people need to be given the option to be able to opt in or out of getting the GA tracking cookie.

Obviously I didn’t want to have a site about the EU Cookie Law that breaks the law, so I decided not to install Google Analytics, or any other 3rd party analytics tools.

I have to say I forgot how much you get can out of the information stored by the likes of Webalizer that comes installed cPanel (which comes with my hosting) – on a project like this were my only real interest in analytics is to look at some visitor counts every so often Webalizer more than meets my needs. I am sure plenty would disagree with me but I am starting to wonder if I need to stop blindly putting GA code into my sites and instead work with what my server can log and give me.

Because I don’t have that tracking code installed, or any social networking plugins it means I could get away without any JavaScript on the site at all.

It has been years since I have been able to write a project that was 100% HTML/CSS and I have to say it was liberating – no debugging to do, no overheads to be concerned about, brilliant.

The Power of Hacker News / Reddit

The only promotion I did upon launching the site was to submit it to both Hacker News and Reddit, I had over 1000 hits on the first day and the traffic is still going strong. I couldn’t have asked for better!

Sorry for the long rambly post!

Share this on

HTML5 Rocks Hangout 1

Yesterday I watched a video taken from a Google+ hangout and really enjoyed it.

Essentially it is three Googlers (Boris Smus, Eric Bidelman, Paul Irish) talking about some of the cool stuff they have been working on. It includes some tips on some JavaScript performance debugging you can do with the soon to be new Chrome dev tools and some other pretty rocking stuff.

Share this on

Tech Tweets – Thursday 15th March 2012

Here is a run-down of the tech tweets I have posted today.

 

  • HTML5 is not ready yet – and will never be (and that is a good thing) – http://j.mp/x7AREq

 

 

 

You can follow me on twitter here.

Share this on

My Feelings On Adobe Edge

Today I was put on record (with my consent!) complaining about Adobe’s new tool – Edge.

Tonight I figured I would a) give it a go and b) explain why I don’t think it is a good idea.

I will cover b) first then show you a)!

So Edge is essentially a tool for writing Flash like animations which utilise current web standards to get the job done.  On the face of it this sounds like a pretty cool idea, since we all hate Flash, right?  I mean it can run in most modern browsers (including iDevices) and sure it doesn’t require you to download a third party plugin to play anything – what isn’t to love.

I will tell you what isn’t to love – the fact that animation isn’t semantic, you can’t display any markup to convey an animation (save for animation within video).  HTML is a Markup Language that should used for turning data into machine readable code to be parsed at will by whatever program wants to.

There is no data you can convey with an animation (or at least that couldn’t be conveyed a more semantic way) so being able to play an animation in HTML is pointless.  It is only good for some visual sprinkles (but then so was Flash!).

Anyway, rant over – I don’t like the idea of squeezing HTML to do something it wasn’t designed for and shouldn’t be used for.  You might, in which case you should download the trail whilst you can.

I did, here are the results.  Edge Test.

Interestingly, the one tag I expected to see was Canvas, I thought this is the ideal HTML5 tag for animation, apart from that I have to say the code it produces is pretty nice, and the learning curve (for someone who last used anything like that over 5 years ago) was pretty shallow.

By the way, I should give some love to the following YouTube video, helping me to get my animation on!

And, you know, if you need any animation work done, well my portfolio speaks for itself!

Share this on