I've got my page working just as I wanted it - but when I came to
validate the XHTML, using W3c's validator it failed. Essentially as
far as I can see it the problem is this:
1: <div>
2: <a href="somelink.htm">
3: <div>
4: <h2>Title</h2>
5: Some text
6: </div>
7: </a>
8: </div>
At line 3, it fails because it says a block level tag (I assume the
<div>) is nexted in an inline tag (which I assume is the <a> tag).
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be 'block' by the CSS, does
this technically mean that the XHTML is valid, as the <a> tag is no
longer inline in this context? 12 2508 se*****@hotmail.com wrote: but when I came to validate the XHTML, using W3c's validator it failed.
1: <div> 2: <a href="somelink.htm"> 3: <div> 4: <h2>Title</h2> 5: Some text 6: </div> 7: </a> 8: </div>
At line 3, it fails because it says a block level tag (I assume the <div>) is nexted in an inline tag (which I assume is the <a> tag).
Yes,.
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be 'block' by the CSS, does this technically mean that the XHTML is valid, as the <a> tag is no longer inline in this context?
No, a stylesheet doesn't matter, the DTD clearly says which elements are
allowed inside of an <a> element and against the DTD the XHTML is not
valid, whatever stylesheet you use.
--
Martin Honnen http://JavaScript.FAQTs.com/ se*****@hotmail.com wrote: I've got my page working just as I wanted it - but when I came to validate the XHTML, using W3c's validator it failed. Essentially as far as I can see it the problem is this:
1: <div> 2: <a href="somelink.htm"> 3: <div> 4: <h2>Title</h2> 5: Some text 6: </div> 7: </a> 8: </div>
At line 3, it fails because it says a block level tag (I assume the <div>) is nexted in an inline tag (which I assume is the <a> tag).
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be 'block' by the CSS, does this technically mean that the XHTML is valid, as the <a> tag is no longer inline in this context?
No. There is only one flavour of valid. Provide an url to the page if
you want suggestions on how to change it.
--
Spartanicus se*****@hotmail.com wrote: I've got my page working just as I wanted it - but when I came to validate the XHTML, using W3c's validator it failed. Essentially as far as I can see it the problem is this:
1: <div> 2: <a href="somelink.htm"> 3: <div> 4: <h2>Title</h2> 5: Some text 6: </div> 7: </a> 8: </div>
At line 3, it fails because it says a block level tag (I assume the <div>) is nexted in an inline tag (which I assume is the <a> tag).
Yes. (once we correct tag -> element)
In the stylesheet I have the a tag set as display:block;
So what? That's just how the <a> element is displayed not what it is.
So my question is, if the <a> tag is set to be 'block' by the CSS, does this technically mean that the XHTML is valid, as the <a> tag is no longer inline in this context?
No. <a> is always an inline element in (x)html regardless of how it is
displayed.
Steve
Thanks - the thing is not live on the internet yet, however I have
constructed a 'test' page which demonstrates the same effect: http://www.seajays.org.uk/test_xhtml.htm
The rollover effect of the box turning grey is what I want - and it
*looks* fine onscreen. It's just that because I had to use <div> to
push each containing box down so that it would carry on past the image,
the whole lot ends up inside the anchor tag, and that won't validate.
Any suggestions gratefully received.
Cheers,
Colin.
"se*****@hotmail.com" <se*****@hotmail.com> wrote: Thanks
Please quote a bit of what it is you are replying to, snip it down to
the minimum, and put your reply beneath it.
- the thing is not live on the internet yet, however I have constructed a 'test' page which demonstrates the same effect:
http://www.seajays.org.uk/test_xhtml.htm
I'd would position the images to the left on the same line as the header
text, and I'd omit hyper linking the text beneath the header. If you do
that then the change is simple, just insert the image in the header and
place the hyper link around the image and header text.
You can keep the existing method, but it would require at least 2 links
pointing at the same page, this is not good UI design.
A compromise is to omit the text beneath the header linking, but keep
the image above the header, you can do that by including the image in
the header and follow it with a <br>.
--
Spartanicus
Spartanicus wrote: "se*****@hotmail.com" <se*****@hotmail.com> wrote:
Thanks Please quote a bit of what it is you are replying to, snip it down to the minimum, and put your reply beneath it.
Yeah Sorry - not yet used to the new Google Groups interface... - the thing is not live on the internet yet, however I have constructed a 'test' page which demonstrates the same effect:
http://www.seajays.org.uk/test_xhtml.htm
I'd would position the images to the left on the same line as the
header text, and I'd omit hyper linking the text beneath the header. If you
do that then the change is simple, just insert the image in the header
and place the hyper link around the image and header text.
OK thanks,
Have tried this (see http://www.seajays.org.uk/test_xhtml2.htm ) - and
the page now validates.
Unfortunately it no longer produces the effect that I wanted. The
'grey' highlight when you hover over is no longer in the entire box,
just over the title. :(
Also on a high resolution screen, if the browser is maximised, the
image starts to poke out of the bottom of the grey box. I had found a
solution to this in the 'expander' div, however we're then back to the
problem of including the div in the anchor element. Is there a way to
ensure that the containing boxes will be the right size to hold the
image, even though the image is floated left?
Another issue is, if the window is resized smaller, the text starts to
wrap around the bottom of the image, instead of keeping itself in line
to the right (as in the first example).
Am I approaching this in the wrong way? Should I just be looking at
using javascript mouseovers to achieve the effect, in order to be able
to write valid XHTML or is there some other method I could try in CSS?
Cheers,
Colin.
"se*****@hotmail.com" <se*****@hotmail.com> wrote: Have tried this (see http://www.seajays.org.uk/test_xhtml2.htm ) - and the page now validates.
Unfortunately it no longer produces the effect that I wanted. The 'grey' highlight when you hover over is no longer in the entire box, just over the title. :(
I see that you've also edited the original example, I didn't notice or
paid any attention to any hover functionality when I looked at the
original example.
[Checks in IE]
Aha, it has a hover effect in IE. Note that very few of the regulars
here use IE as their default browser, so if you upload something that
only works in IE you need to say so (and then duck :-).
Also on a high resolution screen, if the browser is maximised, the image starts to poke out of the bottom of the grey box.
Yep, floats are removed from the flow, however there should be no need
to resort to floating the image, img elements are inline and can thus be
used as is, you can specify alignment of adjacent text with the css
vertical-align property.
Am I approaching this in the wrong way? Should I just be looking at using javascript mouseovers to achieve the effect, in order to be able to write valid XHTML or is there some other method I could try in CSS?
In good browsers the :hover pseudo class can be applied not just on
anchors, but on any element. Alas IE doesn't want to play that game.
I'm can't recall what the best approach is to circumvent that limitation
in IE, others will jump in I'm sure.
--
Spartanicus
On 10 Jan 2005 04:38:41 -0800, se*****@hotmail.com wrote: 1: <div> 2: <a href="somelink.htm"> 3: <div> 4: <h2>Title</h2> 5: Some text 6: </div> 7: </a> 8: </div>
Try this
<div>
<a href="somelink.htm">
<span class="span-made-to-look-like-div" >
<span class="span-made-to-look-like-h2" >Title</span>
Some text
</span>
</a>
</div>
You can probably work out the CSS yourself.
Validity according to the DTD is just that - according to the DTD. It
takes no account of anything you do in the CSS. Besides which, the
DTD works with with a set of elements called "the set of block level
elements", it doesn't even imply any connection with the same notion
of "blockness" as a CSS display:block;
"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:6m********************************@4ax.com... Try this
<div> <a href="somelink.htm"> <span class="span-made-to-look-like-div" > <span class="span-made-to-look-like-h2" >Title</span>
No! A heading should be marked up as a heading. This isn't a correct
solution to his problem.
Some text </span> </a> </div>
Spartanicus wrote: "se*****@hotmail.com" <se*****@hotmail.com> wrote:
Have tried this (see http://www.seajays.org.uk/test_xhtml2.htm ) -
andthe page now validates.
Unfortunately it no longer produces the effect that I wanted. The 'grey' highlight when you hover over is no longer in the entire box, just over the title. :( I see that you've also edited the original example, I didn't notice
or paid any attention to any hover functionality when I looked at the original example.
I don't think I edited the original file... the hover was one of the
main things I wanted. [Checks in IE]
Aha, it has a hover effect in IE. Note that very few of the regulars here use IE as their default browser, so if you upload something that only works in IE you need to say so (and then duck :-).
Well I actually was using Firefox 1.0 - plus it also does work in IE as
you say. Not sure about older Mozilla browsers though. Also on a high resolution screen, if the browser is maximised, the image starts to poke out of the bottom of the grey box.
Yep, floats are removed from the flow, however there should be no
need to resort to floating the image, img elements are inline and can thus
be used as is, you can specify alignment of adjacent text with the css vertical-align property.
Am I approaching this in the wrong way? Should I just be looking at using javascript mouseovers to achieve the effect, in order to be
ableto write valid XHTML or is there some other method I could try in
CSS? In good browsers the :hover pseudo class can be applied not just on anchors, but on any element. Alas IE doesn't want to play that game.
That would be nice... :-)
I'm can't recall what the best approach is to circumvent that
limitation in IE, others will jump in I'm sure.
It would be nice. It's a shame I've managed to get Firefox/IE to have
the 'look' that I was going for, but managed to write invalid XHTML.
If someone can get the same look, but with valid XHTML that would be
great. :)
Maybe I'm just stretching CSS a little too far with the support
available in current browsers, which I why I was wondering if I would
need to go back to javascript? (Although I'd rather not).
I am tempted to say 'it works', and leave it - but that is niggling at
me too, as I know it won't validate even if it does look OK. :(
On Mon, 10 Jan 2005 14:08:10 -0500, "Harlan Messinger"
<h.*********@comcast.net> wrote: No! A heading should be marked up as a heading. This isn't a correct solution to his problem.
Then try this:
<div>
<h2><a href="somelink.htm">Tile</a></h2>
<a href="somelink.htm">
<span class="span-made-to-look-like-div" >
Some text
</span>
</a>
</div>
Obviously duplicating the link is tiresome, but given most automated
CMS tools, it's not actually a big problem.
So what's a "heading" and why is it important to represent it by a
<h2> ? In the CSS+human case it's not important to do this as
they're indistinguishable once rendered anyway. It's only really
valuable to do so when there's some level of automatic processing or
interpretation performed on the basis of <h2> alone. In this case, is
it still really viable to treat "title" as the usually expected and
automatically recognisable <h2>, when it's embedded as a sub-component
of a link ?
The root of the problem is a discontinuity between HTML specification
and usage here. A "link" in HTML is seen as an in-line element, i.e.
largely unstructured and not containing explicit linebreaks. Headings
though are block elements. Although we do permit a line to break
across linebreaks, we forbid it from crossing block elements. It's
arguably quite right to do so, as the wrapping of links across the
ends of block elements is always ugly.
"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:k7********************************@4ax.com... On Mon, 10 Jan 2005 14:08:10 -0500, "Harlan Messinger" <h.*********@comcast.net> wrote:
No! A heading should be marked up as a heading. This isn't a correct solution to his problem. Then try this:
<div> <h2><a href="somelink.htm">Tile</a></h2>
<a href="somelink.htm"> <span class="span-made-to-look-like-div" > Some text </span> </a> </div>
Obviously duplicating the link is tiresome, but given most automated CMS tools, it's not actually a big problem.
So what's a "heading" and why is it important to represent it by a <h2> ? In the CSS+human case it's not important to do this as they're indistinguishable once rendered anyway.
HTML is used to express the structure of a document, *separately* from its
appearance. If appearance were the only consideration, then there would be
no need for P, H1, H2, LI, BLOCKQUOTE, TABLE, etc. HTML would have been
defined such that the body consisted of nothing but a nested collection of
SPAN elements and the occasional IMG or OBJECT, with CSS left to handle the
rest.
It's only really valuable to do so when there's some level of automatic processing or interpretation performed on the basis of <h2> alone.
Such as the processing performed by search engine indexing engines or
adaptive technologies used by visually impaired users.
Also, don't forget users who won't even use your style sheet. With proper
markup, your document can still make perfectly good sense to them.
Otherwise, they'll just see it as an undifferentiated run-on sequence of
text.
In this case, is it still really viable to treat "title" as the usually expected and automatically recognisable <h2>, when it's embedded as a sub-component of a link ?
The fact that the site designer is hyperlinking it *as well* doesn't
subtract from its structural role as a second-level heading on the page. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Philipp Lenssen |
last post by:
I've tested some of the new Nokia 6600 functionality. It ships with
WAP2 and XHTML Support (it says). What it does is check the Doctype --
if it's not the XHTML Mobile Profile Doctype, but a...
|
by: CMAR |
last post by:
What are the pluses and minuses of constructing and validating between
XHTML Transitional vs. HTLM 4.01 Strict
Thanks, CMA
|
by: Cornel Bicutzi |
last post by:
Hello,
What is the difference between HTML and XHTML...
Thanks,
------------------------------------------------------------------------
IT Interview Questions :...
|
by: deko |
last post by:
How do I construct an XHTML-compliant nested unordered list?
This displays correctly (both FF and IE):
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<ul>
<li>nested list...
|
by: dantohester |
last post by:
Hi there,
I have the following situation:
I want to create an XML document that contains 2 parts:
a) a XHTML part (it can be either version 1.0 or 1.1 )
b) a non XHTML part that contains some...
|
by: =?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?= |
last post by:
It is common knowledge that XHTML is better HTML and you can serve XHTML content as HTML.
However, the second statement is incorrect, for various reasons;
it is enough to say that the HTML...
|
by: C.W.Holeman II |
last post by:
For info on the context of my question see the end of this posting.
From http://www.w3.org/TR/XHTMLplusMathMLplusSVG/:
How can I validate the result of client-side XSLT transform which has...
|
by: Henry Stock |
last post by:
I can understand what these error messages are telling me, but I guess I am
not sure how to address them all.
The bold tag could be handled in a class attribute, but I need a <br/tag
inside the...
|
by: Prisoner at War |
last post by:
Actually, it doesn't have to be a blockquote...but I'm at my wits'
end: I want to make bold several lines of text which have a pair of
<br /tags between them...seems like the <b></bdo not "carry...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |