Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 08:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Frage zu Website mit Divs

Discussion on Frage zu Website mit Divs within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2012
Posts: 1,004
Received Thanks: 62
Frage zu Website mit Divs

Hallo,

Ich lerne derzeit das aufbauen einer Website mit CSS und HTML. Die Grundlagen von Tags in HTML und von attributen in CSS kenne ich schon.

Ich habe anhand von Div Containern versucht eine sehr simple Website zu gestalten.

Hier meine Codes:


HTML Code:
Code:
<!DOCTYPE html>
<html>

<head>
    <title>Website Template</title>

    <meta charset="ISO-8859-1">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keywords" content="">
    <meta name="generator" content="Webocton - Scriptly (www.scriptly.de)">

    <link href="css/main.css" type="text/css" rel="stylesheet">
</head>

<body>
        <div id="container">

        <div id="header"><h1>Header</h1></div>
        <div id="navi">Navigation</div>
        <div id="content"><br> <br><br><br>Wassssss <b> geht </b> <i> ab !</i> </div>
        <div id="footer">Footer</div>


        </div>
</body>
</html>
CSS Code:
Code:
body
{
    background-color:black;

}

#container
{
   width:1000px;
   height:800px;
   margin-top:100px;
   margin-left: auto;
   margin-right: auto;
   background-color:white;
   position: static;

}

#header
{
    width:1000px;
    height:200px;
    background-color:red;
    text-align: center;
    font-family: Courier;
    font-size:30px;
    color: #00FFFF;


}

#navi
{
    width:200px;
    height:550px;
    background-color:blue;
}

#footer
{
    width:1000px;
    height:50px;
    background-color: yellow;
}

#content
{
    width:800px;
    height:550px;
    margin-left:200px;
    margin-top:-550px;
    background-color: orange;
    text-align: justify;
    position:static;
}

Die Website an sich wird ohne Fehler angezeigt.
Aufgebaut ist sie so:





Ich wollte fragen ob der Code sauber ist oder ob man was anders machen könnte?

Mfg
imagecload is offline  
Old 08/08/2013, 18:12   #2
 
DJRedMax's Avatar
 
elite*gold: 39
Join Date: Feb 2013
Posts: 1,834
Received Thanks: 83
Das passt im ganzen so wie es ist.
DJRedMax is offline  
Old 08/08/2013, 18:14   #3
 
elite*gold: 0
Join Date: Nov 2012
Posts: 1,004
Received Thanks: 62
Ok. Ich dachte ich habe irgendwelche Fehler drin bzw. Sachen die man besser machen kann.

Die Seite soll jetzt nicht schön aussehen. Sie ist nur dazu da um das ganze zu testen/lernen.
imagecload is offline  
Old 08/08/2013, 18:31   #4
 
Mikesch01's Avatar
 
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
Naja, wenn niemand was zu bemängeln hat..ich hab was

Code:
#container
{
   width:1000px;
   height:800px; /* sollte nur verwendet werden, wenn die Inhalt GENAU 800px groß sein soll, sonst weglassen (dynamische Höhe) */
   margin-top:100px;
   margin-left: auto;
   margin-right: auto; 
   background-color:white;
   position: static; /* sollte nur verwendet werden, wenn der Container beim Scrollen nicht verschoben werden soll (Hintergrund läuft jedoch weiter), sonst raus */
}

#header
{
    width:1000px;
    height:200px;
    background-color:red;
    text-align: center;
    font-family: Courier;
    font-size:30px; /* Angaben mit 'px' möglich, aber üblich ist wohl eher die Angabe in 'pt' (siehe MS Word) oder 'em' (Verhältnismäßig) */
    color: #00FFFF;
}

#content
{
    width:800px;
    height:550px; /* siehe #container height */
    margin-left:200px; /* Bei 2 Div's in einer Zeile (hier: navi und content) solte nicht mit margin sondern mit float gearbeitet werden - nachgooglen! :) */
    margin-top:-550px; /* dito, siehe oben */
    background-color: orange;
    text-align: justify; /* möglich, aber Blockabsätze sind nicht schön zu lesen (sollten nicht für komplette Texte verwendet werden) */
    position:static; /* gehört hier überhaupt nicht hin^^ */
}
Alles rein konstruktive Kritik..nichts persönliches
Mikesch01 is offline  
Thanks
1 User
Old 08/08/2013, 18:33   #5
 
elite*gold: 0
Join Date: Nov 2012
Posts: 1,004
Received Thanks: 62
Danke

Hatte generell Probleme mit 2 Divs in einer Zeile. Ich werde mir mal alles von dir merken.

Wenn ich die auto margins nicht benutze ist die Website auf der linken Seite. Mit ist sie zentriert <.<
imagecload is offline  
Old 08/08/2013, 18:36   #6
 
Mikesch01's Avatar
 
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
Oh ja! Das stimmt Hab mich da vertan. Das ist natürlich wahr. 0 ist die Standardeinstellung.

Habs mal editiert.
Aber ein Tipp am Rande: Du kannst für alle Seiten des Div's das margin mit einem Befehl setzen:

Code:
#bla {
  margin: 100px auto 0 auto; /* margin: oben rechts unten links; */
}
Mikesch01 is offline  
Old 08/08/2013, 18:41   #7
 
elite*gold: 0
Join Date: Nov 2012
Posts: 1,004
Received Thanks: 62
Neuer CSS Code:

Wegen dem dynamischen. Gut wenn die Website aber zu wenig Inhalt hat sieht das bescheuert aus. Und wenn ich im Content inhalt einfüge bleibt es leer

Code:
body
{
    background-color:black;

}

#container
{
   margin: 100px auto auto auto;
   width:1000px;
   height:900px;

   background-color:black;


}

#header
{
    width:1000px;
    height:200px;
    background-color:red;
    text-align: center;
    font-family: Courier;
    font-size:30px;
    color: #00FFFF;


}

#navi
{
    width:200px;
    background-color:blue;
    text-align: center;
}

#footer
{
    width:1000px;
    height:50px;
    background-color: yellow;
}

#content
{
    width:800px;
    float: right;
    margin-top:-650px;
    background-color: orange;
}
imagecload is offline  
Old 08/08/2013, 18:47   #8
 
Mikesch01's Avatar
 
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
Code:
#container
{
   margin: 100px auto auto auto;
   width:1000px;
   height:900px; /* sollte raus */
   background-color:black;
}

#content
{
    width:800px;
    float: right;
    margin-top:-650px; /* wofür ist das?^^ */
    background-color: orange;
    /* Neu hinzugefügt: */
    min-width: 500px; /* eine Mindestgröße kann man angeben, falls die Seite dann tatsächlich so leer ausschaut - jedoch nie eine feste Höhe ;) */
}
Sonst ganz ok.
Mikesch01 is offline  
Old 08/08/2013, 18:50   #9
 
elite*gold: 0
Join Date: Nov 2012
Posts: 1,004
Received Thanks: 62
Gut mit dem margin hab ich mich grad total verplant

So aber das Hauptproblem. Dat margin-top war dazu da damit es nicht so aussieht:



Was kann ich da machen?
imagecload is offline  
Old 08/08/2013, 18:59   #10
 
Mikesch01's Avatar
 
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
CSS

Code:
#navi
{
    width:200px;
    background-color:blue;
    text-align: center;
    float: left; /* neu */
}

#content
{
    width:800px;
    float: right;
    background-color: orange;
    min-width: 500px;
}
HTML

Code:
        <div id="container">

        <div id="header"><h1>Header</h1></div>
        <div id="navi">Navigation</div>
        <div id="content"><br> <br><br><br>Wassssss <b> geht </b> <i> ab !</i> </div>
        <!-- neu: Entfernt alle float's und lässt das Design normal weiter fließen -->
        <div style="clear: both;"></div>
        <div id="footer">Footer</div>


        </div>
Mikesch01 is offline  
Old 08/08/2013, 19:43   #11
 
elite*gold: 0
Join Date: Aug 2012
Posts: 236
Received Thanks: 94
Quote:
Originally Posted by Mikesch01 View Post
Code:
        <!-- neu: Entfernt alle float's und lässt das Design normal weiter fließen -->
        <div style="clear: both;"></div>
Code:
        <!-- TODO: neue CSS-Klasse erstellen -->
        <div class="clear"></div>

Ansonsten könnte man vielleicht noch die neuen HTML5-Sementikelemente verwenden und jedem Starttag ein Endtag zuordnen. IDs könnten u. U. auch durch Klassen ersetzt werden.
Tasiro is offline  
Reply


Similar Threads Similar Threads
CHEAP ELOBOOST ALL DIVS!
07/25/2013 - League of Legends Trading - 7 Replies
Do you want a cheap eloboost? then contact me. Im challenger on 1 acc, and Diamond 1 with around 70lp on another. I boost all divisions from bronze 5 to diamond 1. I dont have a cosistent pricelist, but we can workout a fair price together if you contact me on my skype, my prices are very cheap compared to everyone else. Skype: simon6100
CHEAP ELOBOOST ALL DIVS BY CHALLENGER PLAYERS!
07/25/2013 - League of Legends Trading - 0 Replies
CHEAP ELOBOOST ALL DIVS BY CHALLENGER PLAYERS! Do you want a cheap eloboost? then contact me. Im challenger on 1 acc, and Diamond 1 with around 70lp on another. I boost all divisions from bronze 5 to diamond 1. I dont have a cosistent pricelist, but we can workout a fair price together if you contact me on my skype, my prices are very cheap compared to everyone else. Skype: simon6100
SEO (hidden divs mit keywords)
07/09/2013 - Web Development - 3 Replies
Huhu Leute, hab eine kleine Frage wie es mit versteckten inhalten bzw Stichwörten aussieht. Nimmt Google versteckte stichwörter war bzw. ignioriert er sie oder kann es sogar das Ranking der Seite beschädigen ? Wäre über hinweiße bzw erfahrungsberichte sehr dankbar. Mit freundlichen Grüßen Luli1
[Trading] Duo boost 1-2 divs for an account
06/26/2013 - League of Legends Trading - 0 Replies
im free fro 5-6 hours today can duo que with someone for a basic lol 30 account ;) post here
[HTML] Problem mit Hintergrundbild & DIVs
12/03/2010 - Web Development - 7 Replies
Moin^^, Ich verzweifel langsam am folgenden Problem: In einem DIV-Element befinden sich mehrere Hintergrundbilder, die mit exakten Breitenangaben positioniert sind. Dieses DIV möchte ich aber nun zentriert haben, das liefert aber nicht das gewünschte Ergebnis... Folgendes versucht: text-align: center im Body-Tag (über CSS) margin: 0 auto 0 auto in einem darüber geordnetem DIV-Element



All times are GMT +2. The time now is 08:36.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.