views:

68

answers:

7
+1  A: 

Generally you should not do this, you should let it as the font was conceived by its author.

But it you want to change it you can do it like this:

<p><a href="http://www.example.com/"&gt;
    <span style="position:relative;top:-3px;">&larr;</span> 
    Back
</a></p>

Note: Use what you need instead of -3px, I used that just to illustrate how the position can be changed.

Alin Purcaru
+1  A: 

You can wrap your arrow in SPAN tag and then play with line-height and vertical-align CSS properties.

Māris Kiseļovs
+4  A: 

The arrow is a simple character, so it's aligned like the others (it is in the "middle", the creator of the font wants it to be where it is... maybe that's the middle of lower-case character). Maybe it looks different using another font, maybe not. If you have a fixed font and that one looks messy, you could try to use the :first-letter selector (or wrap the arrow in a span or something) to move it up 1 or 2 px (position:relative: top:-2px;).

Another solution would be to use an image for this, like most websites do (and there are many free icon sets out there — my favourite is famfamfam)

oezi
i love famfamfam :D i also suggest using an icon or a graphic. looks more elagant :D
Harsha M V
@oezi, have you been able to get **first-letter** to work, since I haven't.
Jason
+1  A: 

I think you have to use a image for the left arrow than &larr.
It IS possible to have the &larr in a separate span, have some specific padding to bring the arrow to the right position, or use a specific font that has the arrow at the center, but this will have side effects.

I suggest you use an image.

Nivas
A: 

There are two possible answers to this.

  1. The way you're writing it, this is not a graphical element (arrow) followed by a label ("Back"), but a line of text (inside a paragraph) containing a single character followed by a letter string. So alignment is a purely typographical problem and determined by the font you're choosing. Choose a different font and see if it's more typographically pleasing.
  2. What you want is really not a line of text but two independently placeable graphical elements. Put each inside its own span, give it display: inline-block and position: relative and play with vertical paddings, margins and line-heights until you're satisfied.
chryss
A: 

You have some options: 1. Put the arrow between span tags before the word Back, add an id to this span object and then assign the style in the css file playing with: padding-top or bottom and also vertical-align or position relative. 2. The second option is using the image as background and then you have to create the style for this link:

  li a#link,#link_conten{
      background-image: url(../../../img/arrow.gif);
      background-position: left top;
      background-repeat: no-repeat;
     }

In addition, it is not common (from the semantic point of view) to put just the link (tag a) inside a paragraph (tag p). Then you have to deal with the default css rules for tag a and p but of course depends of your design

Nervo Verdezoto
A: 

You could use CSS generated content. This will mean editing your HTML - to remove the arrow. Essentially you're creating a pseudo-element that sits in front of the link, and you can style it however you like, e.g.

a.back:before {
    content: "\2190 "; /* Unicode equivalent of &larr; */
    display: inline-block;
    padding: 5px;
    background-color: aqua;
}  

On the downside this won't work in IE 6 or 7. You might be able to work around that with some targeted javascript.

If you don't want to edit your HTML, you could give :first-letter a try. It only works on block-level elements, so you'll need to work accordingly, e.g.

a.back {
    display: inline-block;
}
a.back:first-letter {
    background-color: aqua;
    padding: 5px;
}

I've had trouble getting this to display consistently cross-browser though. IE8 and FF3.6 do rather different things with the code.

Olly Hodgson