• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

kasten um countdown

moepf21

Neues Mitglied
wie bekomme ich um den countdown einen schwarzen kasten wobei die schrift jedoch in der mitte bleiben soll

Code:
 <font size=5px><b><u>WM 2010 in Südafrika:</u></b></font><p></p>
 <SPAN id=c1 style="FONT: bold 30px arial; COLOR: black;"></SPAN><br>
 <SPAN id=c2 style="FONT: bold 25px arial; COLOR: red;">;</SPAN><br>
 <small>  h / min / sec </small>

<script type='text/javascript'>
// Erstellt mit dem Countdown-Generator - Homepage-Total.de
var end = new Date('June 11, 2010 00:00:00');
function toSt2(n) {
  s = '';
  if (n < 10) s += '0';
  return (s + n).toString();
}
function toSt3(n) {
  s = '';
  if (n < 10) s += '00';
  else if (n < 100) s += '0';
  return (s + n).toString();
}
function countdown() {
  d = new Date();
  count = Math.floor(end.getTime() - d.getTime());
  if(count > 0) {
    miliseconds = toSt3(count%1000); count = Math.floor(count/1000);
    seconds = toSt2(count%60); count = Math.floor(count/60);
    minutes = toSt2(count%60); count = Math.floor(count/60);
    hours = toSt2(count%24); count = Math.floor(count/24);
    days = count;
    document.getElementById('c1').innerHTML = days + ' TAGE';
    document.getElementById('c2').innerHTML = hours + ':' + minutes + ':' + seconds
    setTimeout('countdown()', 100);
  }
}
countdown();
</script>
</div>
 
mit ner tabelle ^^
dann darin einfach div align="center"
Eine Tabelle gäbe doch überhaupt keinen Sinn!! Tabellenlayout ist genauso veraltet wie das Attribut "align".

@moepf21: Aus deinem Code wird mir leider nicht genau klar, wo genau der Countdown angezeigt wird, generell sieht aber die Syntax so aus:

HTML:
HTML:
<div class="countdown"> Countdown </div>
CSS:
Code:
div.countdown {
background-color:#000;
width:???px; height:???px;
color:#fff;
font-size:1em; font-family:arial; font-weight:bold;
text-align:center;
}
 
@fiedel:
danke funktioniert echt gut
würd gern den countdown noch beliebig positionieren können...
d.h. nicht *nur* mittig oder links rechts

wie müsste ich das machen, mit css?
 
danke! geht super....

wie mach ich das mit einem Link+Bild? Wie verschiebe ich das nach meiner Wahl? hab dazu natürlich auch noch ein beispiel

Code:
<a href=http://www.dfb.de target="_blank"><img src=http://upload.wikimedia.org/wikipedia/de/thumb/c/c0/DFB-Logo.svg/180px-DFB-Logo.svg.png /></a>


PS: Das Forum ist echt ne tolle Sache und Danke an alle die so schnell helfen!
 
Links und Bilder sind beides Inline-Elemente, sie lassen sich also genau gleich positionieren.
 
Zurück
Oben