Category Archives: Uncategorized

CSS Tip: Absolute Positioning Inside Relative Positioning

I was having a little problem with styling a WordPress/Genesis Author Box. The normal layout is that there is an avatar in the top left hand corner around which the text flows- like this:

author-box-1

However, what the client wanted was for the all text to be indented, in a neat column to the right of the image, like this:

author-box-2

Now, my first reaction was that I would need to edit the code which generates the author box, so that the image was wrapped in a block level element, which would then push the text across as required… or something like that. That is a fairly complicated thing to do requiring edits to functions.php and completely disproportionate to what is a pretty minor layout change. I braced myself for the labours ahead.

Then I came across a short article called Absolute Positioning Inside Relative Positioning at CSS Tricks. As the article says – “To some, this is obvious. To others, this may be one of those CSS “Ah-ha!” Moments.” It was for me – I didn’t know you could do that!

The point is as the article says “A page element with relative positioning gives you the control to absolutely position children elements inside of it.”

In my case, restyling the author box took just a couple of minutes and two lines of CSS:

.author-box div {position:relative;margin-left:90px}
.author-box img {position:absolute;left:-90px}

The first line moves all the box contents 90px to the right, the second moves just the image 90px to the left. All done!

Terminology untangled – anchor text and links, or how to make them work for you.

I think we’ve got to a point now, if you’ve made it to this website, where you know what a URL is. (I’m not talking about what it stands for, which is Uniform Resource Locator, but what it is.) It’s that thing you type in the address bar to get to a website – it starts with http:// and includes the domain name and so on. And most people know if they want to add a link in to their post, they need to copy that in. But do you know how to make it look pro? WordPress gives you a tool for it. If you’re in the visual editor it’s right there, looks like this linkicon     When you click it you get this little box linkinsertbox

Now, it’s fairly obvious that you put the place you want to link to in the top slot. But what’s the title all about? Well, that comes up if you mouseover a link. It’s used by some screenreaders, but absolutely shouldn’t be stuffed with SEO stuff, so don’t even go there.

Now you might notice that there’s some text in my paragraph that’s linked there. I did that by selecting the text *before* I clicked the link tool. And the text that is hyperlinked is called the anchor text – it’s information about what the link is going to be about. So, if you want to link to someone’s blog, for example, you might write about Not different but interesting, then select that text, click your link tool, insert the URL and away you go. You’ve got to admit it looks better in the flow of your post than having http://notdifferentbutinteresting.wordpress.com hyperlinked? And it tells the reader (and the search engines) what you think that link is about. Wins all round. Give it a try next time you want to put a link in. (Note blogger has a similar tool. The dialog is a bit better though: bloggerlinkdialog

So it’s got a place to type in the text, makes it plain what you’re putting in linkwise, and even mentions rel=nofollow. If you want to do that on wordpress, you’re going to need a plugin or the text bit of your editor. Let’s cover that, and why you might want to use it, in another post.)

Terminology untangled: domain names, DNS and hosting.

When you go to set up a website, it can be rather confusing trying to decipher the jargon. People throw around terms like domain names, URL, hosting, DNS, and it can be difficult at best to work out what is what. I think that’s part of the reason people often start with free sites like blogspot and wordpress.com and stay there – because they don’t know what it’s all about, and can be scared to ask.

Fear not. If you’re a teen, my daughter is working her way through it and blogging it for you at Tech for Teens. If your teen years are behind you, I’ll be explaining it here too. Between us we should get you sorted.

A blog held at blogger might be at something like http://myblog.blogspot.co.uk Each bit of that has a meaning. The http refers to the protocol used to transfer data – it’s hypertext transfer protocol. It tells a browser what type of data it’s moving about. myblog is a subdomain, blogspot.co.uk is a domain name – in this case belonging to the .co.uk which should be UK companies.

If you go to buy a domain name you’ll use a registrar, someone like Low Cost Names. (Other registrars are available.) We (human beings) use domain names because they are easy for us to remember – computers actually work in numbers called IP addresses. They are in four blocks of up to three numbers, so something like 123.123.123.123 The bit of software that links the two together is a nameserver – it tells the enquiring computer which IP address to find a domain name at. Somewhere at your registrar you should be able to edit DNS (the domain name system information) – you’ll either put in nameserver values given to you by your hosting company (and the hosting company will have set up the right links), or use the nameservers at the registrar and fill in the IP values – but you’ll need to know what values to put in what records, which is beyond this article I’m afraid.

A hosting company maintains servers (computers) and you rent space on them for your website to sit on, as well as traffic to and from them measured in bandwidth. Your website is made up of files that you put there using ftp or file transfer protocol, maybe with a program like filezilla. Or you might find that the company has a system in the control panel that allows you to push a button and install something like wordpress without having to worry about transferring files, which will make your life easier.

That’s a really quick run down of some of the basic terminology that you need to know about. If it’s raised more questions than it’s answered, feel free to leave a comment and I’ll try to explain it further.