Posts Tagged ‘Hello World’

How to center a header, with HTML and CSS

Here’s a quick tip that’ll help you centre a heading using nothing more than a little bit of HTML and CSS.

First, in a new HTML document (which you can create using something as simple as NotePad or Textedit simply by saving your text document with the .html extension), you’ll want to create a new heading. You can do it by including the following code in your document:

<h1>Hello World</h1>

This text adds a standard heading to your website but what if you want to centre the heading on the page? Easy! Let’s modify the standard <h1> tag to apply a style sheet directly to it:

<h1 style=’text-align:center;’>Hello World</h1>

You’ll notice that I don’t need to setup an individual style sheet to accomplish this task, simply adding the style attribute will allow me to make the changes to this one specific item. If I want to be able to centre multiple items, I could use a style sheet class to accomplish the task:

<style>
.center {text-align: center;}
</style>
<h1 class=’center’>Hello World</h1>

Note the class is represented in the style sheet as a period (.) plus the name of the class. Similarly, if I wanted to assign the centre to all occorances of the <h1> tag I could use:

<style>
h1{text-align: center;}
</style>
<h1>Hello World</h1>

How to Create Reflective Text in Adobe Photoshop CS3

tutorials/photoshop/createanewdocument.jpgThis is a simple tutorial used in some of my classes to help first year design students understand the basics of Adobe Photoshop as well as how to use Layers properly.

First, lets start by creating a new document using the CTRL-N button and we’ll set the size to 200px wide by 100px high. This will give us a simple work space to create our document from.

Now, using the text tool (tutorials/photoshop/texttoolicon.jpg) let’s type some basic text such as “Hello World” in the center of our document, you may want to resize the text or alter it to create the effect you want. Once complete, let’s duplicate the layer by using the CTRL-J shortcut or selecting Duplicate Layer from the Layer menu.

tutorials/photoshop/layers.jpgThe duplicated layer (most likely named Hello World Copy or something similar) will appear above your first layer in the Layers pallet on your right hand side. The new layer is going to be used for the rest of this tutorial so be sure that you have it selected and we’ll continue.

The next step is to Right Click on the layer to expose the dynamic menu, use this menu to find and select Rasterize Text. Your text is now just a series of pixels and is no longer editable, this is exactly what we want.

With the freshly rasterized text layer still selected we’ll use the CTRL-T keyboard shortcut to transform the layer. Your image text should now have a series of six small hollow squares around them. Right Click any of the boxes and select Flip Vertical.

Now drag your selected text until the top of it lines up with the bottom of your initial text, what you should be left with is a copy of your original text mirrored directly below it.

Our final step in this tutorial is to make the text appear reflective which involved fading it gently and to do this, we want to add a layer mask which is a method of adding transparency to an object gradually.

layermask How to Create Reflective Text in Adobe Photoshop CS3 imageTo do this, we want to use the menu item Layer > Layer Mask > Reveal All which adds a layer mask to our existing layer. The layer now contains a second box, this is the transparency channel for our layer.

tutorials/photoshop/layers.jpgTo make this mask work to our desired effect, we need to add a black and white gradient to our document. Let’s restore Photoshop to it’s default color mode by pressing the CTRL-D keyboard shortcut. This will ensure our colors are black and white. Select the gradient tool (tutorials/photoshop/texttoolicon.jpg) and apply it from the bottom of your text up, until you get the desired effect.

You can use this simple reflective text method on images or graphics as well as text and it’s a great way to learn basic web type standards.

Download the Photoshop File