Jump to content

Which Way Is Better?


Alexancho

Recommended Posts

The task is to create links:84280713bc76.pngIt can be done using HTML only. Something like this:

<a href="#"><img border="0" src="images/img10.gif" width="9" height="11" alt="" /></a>  <a href="#">Read More</a>bsp;    <a href="#"><img border="0" src="images/img11.gif" width="13" height="12" alt="" /></a>  <a href="#">Comments (33)</a>

But it also can be done using CSS. For that you have to create classes, write a bit more. Which way is preferable? And in the case of using CSS what is better to use an image as a background or just as an image?

Link to comment
Share on other sites

It is always preferable to write pages that use a strict doctype and will validate as strict. If you don't, IE6-7 will render your designs in a way that is VERY different from all other browsers. This makes designing very difficult. So right away, CSS is to be preferred. Using width and height attributes in most element tags will keep the page from being rendered strictly.CSS (margins or padding) is also preferable to   for creating spaces and gaps. The size of a   depends on your font size, so it cannot be predicted with any accuracy. With CSS you can create a space of exactly 20 pixels, if that is what you require. You don't have to guess.The choice between using an image element or a background image comes down to this: is the image part of the content or part of the decoration? For example: if your page is a biography of a famous composer, then an image of the composer would be part of the content. Use an image tag. If the image makes a button look pretty, it should be background. In the examples you showed, find a way to make your images the background of something.FWIW, I generally do not find that CSS turns into more writing. The writing just gets put into different places. And when I define a class that gets used several times, I end up using LESS writing. The HTML sections also end up cleaner and easier to understand.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...