Zaloguj | Zarejestruj | FAQ
Anonymous

why the result is not coming as it suppose to?

+ Odpowiedz

Posty: 6 Strona 1 z 1


why the result is not coming as it suppose to?

przez Marsha Daryabeigi » Wt lut 03, 2015 5:25 pm

I followed the tutorial and wrote a little code as I understood but the result does not appear, the link does not show as it is link (blue) What is missing on the script?
Here is the code

on style16ln.css

a:link {color: 6699cc;}
a:visited {color: #660099;}

on video16lnk2.html file

<html>
<head>
<title>My document</title>
<link rel="stylesheet" type="text/css" href="style16ln.css"/>
</head>
<body>
<h1>This is unvisited </h1>
<a><p> Link where are you?</p></a>

</body>
</html>
Avatar użytkownika

Marsha Daryabeigi

  • Posty: 29
  • Dołączył(a): Pn gru 08, 2014 5:40 pm

Re: why the result is not coming as it suppose to?

przez nanoverso » Wt lut 03, 2015 6:50 pm

Try moving the <p> inside the link to outside AND specify a link destiny inside the <a> with href, eg: <a href="#">.

Good luck !
Avatar użytkownika

nanoverso

  • Posty: 253
  • Dołączył(a): So maja 10, 2014 12:08 am
  • Lokalizacja: Brazil
--
Free VST Plugins Download.

Re: why the result is not coming as it suppose to?

przez Marsha Daryabeigi » Wt lut 03, 2015 8:12 pm

I know it works with href="#" I did other tests too which worked. But I was wondering why it is not working with referenced file.
Avatar użytkownika

Marsha Daryabeigi

  • Posty: 29
  • Dołączył(a): Pn gru 08, 2014 5:40 pm

Re: why the result is not coming as it suppose to?

przez nanoverso » Śr lut 04, 2015 6:51 pm

I think <a> tag must have a href attribute, not sure about uses without with.
Avatar użytkownika

nanoverso

  • Posty: 253
  • Dołączył(a): So maja 10, 2014 12:08 am
  • Lokalizacja: Brazil
--
Free VST Plugins Download.

Re: why the result is not coming as it suppose to?

przez CubeSquare » Cz lut 05, 2015 1:47 am

It's hard to ask the right questions of a website that's not really a website. I could try to formalize the code and see if that bears any fruit.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> what?</title>
<link rel="stylesheet" type="text/css" href="style16ln.css" />
</head>
<body>
<h1>This is unvisited</h1>
<a><p>Link where are you?</p></a>
</body>
</html>


a:link {color: 6699cc;}
a:visited {color: #660099;}


So, what happens? Well, the program runs as well as it can. There are no colors for a:link and a:visited because they are not defined. But when you validate, you get this:

Error Line 11, Column 3: document type does not allow element "a" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

<a><p>Link where are you?</p></a>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

And there it is! Your problem is one of improper nesting. You attempted to place a block level element inside an in-line element (an anchor)

Hat's off to nanoverso who knew instinctively what the problem was. And a tip of the hat to Marsha who stubbornly wanted the answer.
Avatar użytkownika

CubeSquare
Moderator

  • Posty: 9
  • Dołączył(a): N wrz 26, 2010 6:04 pm

Re: why the result is not coming as it suppose to?

przez Marsha Daryabeigi » Cz lut 05, 2015 7:06 pm

Thank you for answer.
Avatar użytkownika

Marsha Daryabeigi

  • Posty: 29
  • Dołączył(a): Pn gru 08, 2014 5:40 pm


+ Odpowiedz

Strona 1 z 1