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

Odpovědět
BRABO[*_*]
Level 1.5
Level 1.5
Příspěvky: 122
Registrován: 15 led 2008 15:19

Jak opravit chybu v xhtml kodu?

Příspěvek od BRABO[*_*] »

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).
Uživatelský avatar
Myloš
Master Level 8.5
Master Level 8.5
Příspěvky: 6991
Registrován: 11 dub 2006 09:09
Bydliště: Praha

Re: Jak opravit chybu v xhtml kodu?

Příspěvek od Myloš »

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: 15 led 2008 15:19

Re: Jak opravit chybu v xhtml kodu?

Příspěvek od BRABO[*_*] »

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: 13 pro 2007 16:28

Re: Jak opravit chybu v xhtml kodu?

Příspěvek od Tholus »

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:
Odpovědět

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