Jak opravit chybu v xhtml kodu?

Místo pro dotazy a rady ohledně programovacích jazyků (C++, C#, PHP, ASP, Javascript, VBS..) a tvorby webových stránek

Moderátor: Mods_senior

BRABO[*_*]
Level 1.5
Level 1.5
Příspěvky: 122
Registrován: leden 08
Pohlaví: Muž
Stav:
Offline

Jak opravit chybu v xhtml kodu?

Příspěvekod BRABO[*_*] » 08 lis 2008 21:27

Dobrý večer
Potřeboval bych poradit. Jak opravit tuto chybo v mém kódu? Z 39 chyb jsem, se dopracoval k jedné a nevím jak jí opravit.
Stále mi to vypisuje, že je chyba zde <center>. Jestli mi neporadíte ani vy tak už jsem v koncích.
PS: Sice mi to tam píše čím to je, ale má angličtina je mizerná a z toho co jsem si přeložil nechápu jak to opravit.

Kód: Vybrat vše

   1.   Error  Line 50, Column 10: element "center" undefined.

               <center><h2><span style="color: black">Upozornění:</span></h2></center>


      You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
          * incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
          * by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
          * by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).

Reklama
Uživatelský avatar
Myloš
Master Level 8.5
Master Level 8.5
Příspěvky: 6991
Registrován: duben 06
Bydliště: Praha
Pohlaví: Muž
Stav:
Offline

Re: Jak opravit chybu v xhtml kodu?

Příspěvekod Myloš » 08 lis 2008 21:32

Zřejmě používáš <!DOCTYPE, ve kterém <center> není (nesmí být).
Pokud ti jde o funkčnost, kašli na to; prohlížeče nesmějí <center> neumět.
Pokud ti jde o validitu, použij vlastnost align s hodnotou center (buď jako HTML <h2 align="center">, nebo přes CSS).

Pokud dobře nerozumíš anglickým hláškám, používej český validátor: http://validator.w3.cz/

BRABO[*_*]
Level 1.5
Level 1.5
Příspěvky: 122
Registrován: leden 08
Pohlaví: Muž
Stav:
Offline

Re: Jak opravit chybu v xhtml kodu?

Příspěvekod BRABO[*_*] » 08 lis 2008 21:40

Děkuji ty moc. Bez tebe bych na to nepřišel. Dík za ten typ na ten validátor určitě ho použiji.

Tholus
Level 5.5
Level 5.5
Příspěvky: 3081
Registrován: prosinec 07
Pohlaví: Muž
Stav:
Offline

Re: Jak opravit chybu v xhtml kodu?

Příspěvekod Tholus » 08 lis 2008 21:43

Stačí do css vložit toto:

.center {text-align: center;}

Místo <center>:

<div class="center">

A místo </center>:

</div>

:wink:

EDIT: Sorry, pokud jsi to předtím zkoušel, nešlo to, protože jsem napsal místo text-align align. Teď je to opravený. :wink:


Zpět na “Programování a tvorba webu”

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 5 hostů