1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Any reason to rather use CSS and not HTML...

Discussion in 'HTML & Website Design' started by tayiper, Sep 14, 2006.

  1. #1
    .... in a totally basic/fundamental case of, for instance, specifying the border around a graphic/image on a page?? I mean is it generally better to use CSS instead of HTML, or in such cases as border around a graphic it doesn't matter, and one should probably only look for a size of the code (i.e. which method needs more lines/chars), at least if one is a minimalist like I am, lol.


    The "CSS-style example code:

    <img style="border:0; width:88px; height:31px" src="http://example.com/some-image.gif" alt="some-image.gif">
    Code (markup):

    The HTML style example code:

    <img border="0" width= "88px" height="31px" src="http://example.com/some-image.gif" alt="some-image.gif">
    Code (markup):

    I am also curious, is there any "unwritten rule" that says which particular tag to use in which order; in CSS-style's case, which one is first, which one second etc.: "style", "src", or "alt" (and maybe we can include title), and in HTML-style's case, the appropriate order of the main/non-optional "style" and "src" (and again, we can possibly include alt and title ones too), and a sort of a "inner order" of border, width, and height ones ??


    tayiper
     
    tayiper, Sep 14, 2006 IP
  2. jose17

    jose17 Peon

    Messages:
    266
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    One of the most important reasons why it's better to use CSS instead of HTML when it comes to defining how your website looks (i.e. colo of background, font color, border of images, etc) is that you can do all the styles in a CSS file and then just link this sheet to many HTML pages. And how does this comes handY?

    Well for instance once you finish your site and you decide to change the background color of your site, if you use HTML you would have to open all the HTML pages you made and change the background tag for each page which is time consuming and annoying. In the other hand if you would have used CSS and link it to all your sites, you would just go to the sheet and change the properity of the background color and automatically the background on all your pages would change.

    Also CSS gives you more control of how your web page looks.

    Jose
     
    jose17, Sep 14, 2006 IP
    tayiper likes this.
  3. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Yeah, I know the difference between CSS and HTML, I was rather interested in this particular example, where the CSS is inline one (not external), but it is true, I did ask a question in general way.


    Anyway, I was told on some other forum that the "align", "border", "hspace", and "vspace" attributes of the image element were deprecated in HTML 4.01, and additionally, they are not supported in XHTML 1.0 Strict (however regarding DTD, I use the XHTML 1.0 Transitional)


    tayiper
     
    tayiper, Sep 14, 2006 IP
  4. jose17

    jose17 Peon

    Messages:
    266
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    oh sorry, i thought you meant why use CSS instead of HTML :p
     
    jose17, Sep 14, 2006 IP
  5. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #5
    Yes sorry, I indeed did ask in "that kind" od way, lol ...


    tayiper
     
    tayiper, Sep 14, 2006 IP
  6. jose17

    jose17 Peon

    Messages:
    266
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    SO what you are asking If it matters whetehr certaing tags have to be written before others?
     
    jose17, Sep 14, 2006 IP
  7. ifyn

    ifyn Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You need to worry about html tags only if you use xhtml strict, it is indeed not allowed to use Attributes name, align, border, hspace, vspace for img tag

    here is a complete list : liorean.web-graphics.com/xhtml/comparison.loose-strict.html
     
    ifyn, Sep 16, 2006 IP