SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Sep 14, 2006, 15:24 #1
- Join Date
- May 2006
- Location
- Ljubljana, Slovenija, Europe
- Posts
- 34
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there any reason to use CSS instead of HTML ??
For instance, consider a totally banal case of specifying the border (values 1 or 0) around an image?? I mean is it generally better to use CSS instead of HTML, or in such cases 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 --
...
So here is "CSS-style" example:
Code:<img style="border:0; width:88px; height:31px" src="http://example.com/some-image.gif" alt="some-image.gif">
And an "HTML-style" example:
Code:<img border="0" width= "88px" height="31px" src="http://example.com/some-image.gif" alt="some-image.gif">
satyrLast edited by satyr; Sep 14, 2006 at 16:47. Reason: just fixed the BBCode, i.e. an "one letter" fix ...
See my computing-related homepage: http://tadej-ivan.50webs.com/.
-
Sep 14, 2006, 16:30 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
deprecated
From w3schools http://www.w3schools.com/tags/tag_img.asp
The "align", "border", "hspace", and "vspace" attributes of the image element were deprecated in HTML 4.01.
The "align", "border", "hspace", and "vspace" attributes of the image element are not supported in XHTML 1.0 Strict DTD.
Of course, images may be the exception, as they have unique heights and widths.Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Sep 14, 2006, 17:09 #3
- Join Date
- May 2006
- Location
- Ljubljana, Slovenija, Europe
- Posts
- 34
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ahhhh I see now, they are deprecated (however, I use the XHTML 1.0 Transitional DTD, not a Strict one), anyway, thanks much "Mittineague" for a quick answer ...
satyrLast edited by satyr; Sep 14, 2006 at 20:31. Reason: minor edit
See my computing-related homepage: http://tadej-ivan.50webs.com/.
-
Sep 14, 2006, 22:23 #4
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Your HTML example is incorrect (dimensions in HTML attributes are always in pixels unless there's a '%' at the end, so it should be width="88" etc.).
The idea is to use external CSS as much as possible, thus separating the markup from the presentation. If you then want to change the styling of your site, you only have to change one style sheet instead of thousands of HTML files.
So,
HTML Code:<img id="some-image" src="http://example.com/some-image.gif" alt="Text equivalent">
Code:img { border:0; } #some-image { width:88px; height:31px; }
Birnam wood is come to Dunsinane
-
Sep 14, 2006, 22:44 #5
- Join Date
- May 2006
- Location
- Ljubljana, Slovenija, Europe
- Posts
- 34
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by AutisticCuckoo
satyrSee my computing-related homepage: http://tadej-ivan.50webs.com/.
Bookmarks