CSS CSS - Anfänger hat problem mit divs

Atreju93

Lieutenant
Registriert
Nov. 2010
Beiträge
596
Hallo zusammen

Ich bin gerade daran ein kleines Template für eine eigene Website umzubauen. Ich kann etwas programmieren und habe Grundkenntnisse in HTML sowie CSS. Jedoch habe ich nie auf diesem Gebiet wirklich etwas gemacht (war nur mal ein Kurs)

Ich habe nun folgendes Problem:

Die Website sieht folgendermassen aus (siehe Anhang)

Und da seht ihr mein Problem - der Rahmen um das Div passt sich am Text an, aber nicht am Bild - zudem möchte ich gerne die ganze Breite ausnützen..!

Doch ich finde auf würgen und schlagen nicht heraus, wie ich dies verbreitere. Alle Breitenangaben, die ich finde reagieren auf Änderung nicht so wie ich will.

Hier mal der betreffende Ausschnit aus HTML:

Code:
            <div id="templatemo_middle">
            
            	<div class="templatemo_middle_section_box">
                
                	<div class="templatemo_middle_section_box_top">
                    	<h1>The Bacons</h1>
                    </div>
                    <div class="templatemo_middle_section_box_mid">
                    	<!--
                     <img src="images/templatemo_thumb2.jpg" alt="Atrist" />
                         --> 
                    <p>  Wir sind The Bacons..! </p>
                        
                      <p> Die Band besteht aus Den Gitarristen Daniel & Florian Hasler, dem Bassisten Simon Wüthrich, Drummer Harry Käser sowie dem Gesang Dominique Minder</p>
                        
                        <h1>So sehen wir genial aus..!</h1>
                        
                        <img src="images/bacons.jpg" height="300" width="210" alt="THE BACONS" align="center" />
                         
                      <p> Das ist sogenannter Fülltext....</p>
                        
                        <p class="bottom_padding"> in faucibus orci luctus et ultrices posuere cubilia Curae Nrci tristique massa fermentum volutpat. Pellentesque habitantm tristique senectus et netus et malesuada. Praesent volutpat, velit sit amet bibendum ultricies.
													in faucibus orci luctus et ultrices posuere cubilia Curae Nrci tristique massa fermentum volutpat. Pellentesque habitantm tristique senectus et netus et malesuada. Praesent volutpat, velit sit amet bibendum ultricies</p>
                    </div>
                    <div class="templatemo_middle_section_box_bottom">
                    </div>
                    
                </div>
                
            </div><!-- End Of middle -->

Und hier der betreffende Teil aus CSS:

Code:
#templatemo_middle {
	
	float: left;
	width: 455px;
	margin: 0;
	padding: 15px 15px 0 15px ;

}

#templatemo_middle .templatemo_middle_section_box {
	
	width: 455px;
	margin: 0 0 15px 0;
	padding: 0;
	
	
}

.templatemo_middle_section_box .templatemo_middle_section_box_top {
	
	width: 440px;
	height: 35px;
	background: url(images/templatemo_mid_section_top.jpg) no-repeat;
	margin: 0;
	padding: 13px 0 0 15px;
	
}

.templatemo_middle_section_box_top h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 0;
	padding: 5px 0 0 40px;
}

.templatemo_middle_section_box  .templatemo_middle_section_box_mid {
	
	width: 425px;
	background: url(images/templatemo_mid_section_mid.jpg) repeat-y;
	margin: 0;
	padding: 15px 15px 0 15px;
	
}

.templatemo_middle_section_box_mid p {
	font-family: Arial;
	font-size: 12px;
	color: #fff;
	text-align: justify;
	margin: 0 0 0 0;
	padding: 0 0 10px 0;

}

.templatemo_middle_section_box_mid img {
	
	float: left;
	margin: 0 5px 5px 0;
	padding: 0;

}

.templatemo_middle_section_box .bottom_padding {
	padding: 0;
	
}


.templatemo_middle_section_box_mid  h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 10px 0 10px 0;
	padding: 5px 0 0 40px;
}


.templatemo_middle_section_box  .templatemo_middle_section_box_bottom {
	
	width: 455px;
	height: 23px;
	background: url(images/templatemo_mid_section_bottom.jpg) no-repeat;
	margin: 0;
	padding: 0;
	
}

Was muss ich ändern, damit ich diesen Rahmen grösser kriege? Wenn ich jede breite auf z.b. 600px ändere, dann wird sehr wohl der text breiter, jedoch der Rahmen nicht.. wenn ich aber im HTML text ergänze, passt sich der rahmen dem Mehrtext an.

mfg
 

Anhänge

  • 1_.jpg
    1_.jpg
    259,2 KB · Aufrufe: 284
Hallo,

soweit ich das verstanden habe, willst Du den abgerundeten Rahmen breiter machen, richtig?

Ich würde den Inhalt des <div>-Tags in eine Tabelle machen und deren Breite einen festen Wert zuweisen.

Beispiel:
Code:
<div width="100%">
   <table width="100%">
      <tr><td colspan="2">Überschrift 1</td></tr>
      <tr><td colspan="2">Text</td></tr>
      <tr><td colspan="2">Überschrift 2</td></tr>
      <tr>
         <td>Bild</td>
         <td>Text</td>
      </tr>
   </table>
</div>


Gruß
Frog33r
 
Zuletzt bearbeitet:
Genau. Ich sehe nirgends, wo der definiert wurde (breite, ausrichtung, padding, border.. usw)

Hmm.. werde ich mal ausprobieren.
 
Würden ein bis zwei Absätze ( <p>&nbsp;</p> ) nicht genügen?
 
@Frog33r: NIE NIE NIE verwendet man <table> für etwas anderes als tabellarische Daten. Tabellen sind keine Designelemente

Was das eigentliche Problem angeht: Ohne jetzt den CSS-Code ernsthaft gelesen zu haben kann ich dir an dem Foto schon sagen, was falsch läuft: Das Bild ist bestimmt gefloatet. Das ist ein übliches Problem mit Floats.
Pack mal folgendes als letztes Element innerhalb des Rahmens:
HTML:
<div style="clear:both;"></div>

Das dürfte das Problem beseitigen. Ist nicht unbedingt die sauberste Lösung, aber zu mehr bin ich grad nicht in der Lage. Scheiß drückend schwüle Luft schlägt mir auf den Schädel.
 
Zuletzt bearbeitet: (das Semikolon hinterm clear fehlte.)
Hallo,

@Daaron: So wie ich den Code geschrieben habe, verwende ich die Tabelle für einen tabellarischen Aufbau und nicht als Design. Wo ist das Problem?


Gruß
Frog33r
 
Also Hier mal den Kompletten Code - damit ich nichts falsch mache. Das mit dem Clear.both war schon in etwa so vorhanden.

Hier die probeweise aufegschaltete Website: Wundert euch (noch) nicht über den Inhalt.

Klick
Bei der Homeseite (Home) ist noch die fast originale Vorlage mit links und rechts den Divs. Die habe ich in "die band" entfernt und wollte das mittlere stattdessen vergrössern
Hier der HTML:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Bacons - Official Website</title>
<meta name="keywords" content="Guitar, Rock N Roll, Bacons, Metal, Music, Walterswil, Bass, Drums, Schlagzeug, Band" />
<meta name="description" content="The Bacons" />
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="templatemo_container">
    	<div id="templatemo_header">
        	<div id="templatemo_menu_section">
            	<ul>
                	<li><a href="index.html" class="current">Home</a></li>
					<li><a href="theband.html" class="templatemo_middle_section_box_mid">Die Band</a></li>
                    <li><a href="#">Songs</a></li>
                    <li><a href="#">Auftritte</a></li>
                    <li><a href="#">Gallerie</a></li>
                    <li><a href="#">News</a></li>
                    <li><a href="#" class="last">Kontakt</a></li>
                 </ul>
            </div>
        </div>
        <!--
        <div id="templatemo_content_area">
        	
            <div id="templatemo_left">
            
            	<div class="templatemo_left_section_box">
                
                	<div class="templatemo_left_section_box_top">
                    	<h1> Stuff</h1>
                    </div>
                    <div class="templatemo_left_section_box_mid">
                    	<p>Hier könnte Ihre Werbung stehen...</p>
                    	<p>No Risk - No Fun</p>
                    	<h1> Stuff Again</h1>
                      <p class="bottom_padding"><a href="#">Sinnloser Link...</a></p>
                      <p class="bottom_padding"><a href="#">Sinnloser Link...</a> </p>
                      <p class="bottom_padding"><a href="#">Sinnloser Link...</a> </p>
                      <p class="bottom_padding"><a href="#">Sinnloser Link...</a></p>
					  <!--
                      <h1>W3C Validated</h1>
                        <p>
                        <a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" width="88" height="31" border="0" /></a>

        	<a href="http://jigsaw.w3.org/css-validator/check/referer">
    <img style="border:0;width:88px;height:31px" alt="Valid CSS"
        src="http://jigsaw.w3.org/css-validator/images/vcss-blue" /></a>
        			</p> 
					--
                    </div>
                    <div class="templatemo_left_section_box_bottom">
                    </div>
                    
                </div>
                
            </div><!-- End Of left -->
            
            <div id="templatemo_middle">
            
            	<div class="templatemo_middle_section_box">
                
                	<div class="templatemo_middle_section_box_top">
                    	<h1>The Bacons</h1>
                    </div>
                    <div class="templatemo_middle_section_box_mid">
                    	<!--
                     <img src="images/templatemo_thumb2.jpg" alt="Atrist" />
                         --> 
                    <p>  Wir sind The Bacons..! </p>
                        
                      <p> Die Band besteht aus Den Gitarristen Daniel & Florian Hasler, dem Bassisten Simon Wüthrich, Drummer Harry Käser sowie dem Gesang Dominique Minder</p>
                        
                        <h1>So sehen wir genial aus..!</h1>
                        
                        <img src="images/bacons.jpg" height="300" width="210" alt="THE BACONS" align="center" />
                         
                      <p> Das ist sogenannter Fülltext....</p>
                        
                        <p class="bottom_padding"> in faucibus orci luctus et ultrices posuere cubilia Curae Nrci tristique massa fermentum volutpat. Pellentesque habitantm tristique senectus et netus et malesuada. Praesent volutpat, velit sit amet bibendum ultricies.
													in faucibus orci luctus et ultrices posuere cubilia Curae Nrci tristique massa fermentum volutpat. Pellentesque habitantm tristique senectus et netus et malesuada. Praesent volutpat, velit sit amet bibendum ultricies</p>
                    </div>
                    <div class="templatemo_middle_section_box_bottom">
                    </div>
                    
                </div>
                
            </div><!-- End Of middle -->
            <!--
            <div id="templatemo_right">
            
            	<div class="templatemo_right_section_box">
                
                	<div class="templatemo_right_section_box_top">
                    	<h1>Albums</h1>
                  </div>
                    <div class="templatemo_right_section_box_mid">
                    	<ul>
                        	<li><a href="#">Ut consequat, ante egestas tristique</a></li>
                            <li><a href="#">Con gue, magna magna scele ris que</a></li>
                            <li><a href="#">Non congue est nibh quis est</a></li> 
                            <li><a href="#">Suspendisse pharetra eros molestie</a></li> 
                            <li><a href="#">orci tempus iaculis. Sed ac porta dui</a></li>
                        </ul>
                    </div>
                    <div class="templatemo_right_section_box_bottom">
                    </div>
                    
                </div>
                
                <div class="templatemo_right_section_box">
                
                	<div class="templatemo_right_section_box_top">
                    	<h1>Artists</h1>
                    </div>
                    <div class="templatemo_right_section_box_mid">
                    	<ul>
                        	<li><a href="#">Egestas Tristique</a></li>
                            <li><a href="#">Scele Risque</a></li>
                            <li><a href="#">Est Nibhquis</a></li> 
                            <li><a href="#">Disse Pharetra</a></li> 
                            <li><a href="#">Porta Dui</a></li>
                        </ul>
                    </div>
                    <div class="templatemo_right_section_box_bottom">
                    </div>
                    
                </div>
                
            </div><!-- End Of right -->
            
            <div class="cleaner"></div>
        
    	</div><!-- End Of content area -->
    
    </div><!-- End Of container -->
    
    <div id="templatemo_bottom_bg">
    	<div class="templatemo_container">
        
    		<div id="templatemo_footer">
            	<div class="templatemo_footer_section">
					<a href="#">Home</a> | <a href="#">Die Band</a> | <a href="#">Songs</a> | <a href="#">Auftritte</a> | <a href="#">TGallerie</a> | <a href="#">News</a> | <a href="#">Kontakt</a>
                </div>
                <div class="templatemo_footer_section">
                	Copyright © 2024 <a href="#">Your Company Name</a> | Designed by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
                </div>
	        </div>
            
		</div>
	</div>
    <!--  Free Web Templates from TemplateMo.com  -->
</body>
</html>

Und hier der CSS Code:

Code:
/*
CSS Credit: http://www.templatemo.com
*/

html {
	background: #373737;
}

body {
	margin: 0;
	padding:0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 1.5em;
	width: 100%;
	display: table;
	background: url(images/templatemo_top_bg.jpg) #000 repeat-x;
}

a:link, a:visited {	color: #fff; text-decoration: underline; }
a:active, a:hover { color: #bbb; text-decoration: none; }


.templatemo_container {

	width: 950px;
	margin: auto;

}

#templatemo_header {
	
	width: 950px;
	height: 331px;
	background: url(images/templatemo_header.jpg) no-repeat;
	
}

/* Menu Section */

#templatemo_menu_section{
	width: 950px;
	height: 35px;
	float: left;	
	margin: 295px 0 0 0;
	padding: 0;

}

#templatemo_menu_section ul {
	float: left;
	width: 920px;
	margin: 0 0 0 0;
	padding: 0;
	list-style: none;
}

#templatemo_menu_section ul li {
	display: inline;	
}

#templatemo_menu_section ul li a {
	float: left;
	padding: 8px 30px 0 30px;
	margin: 0;
	height: 26px;
	font-family: Arial;
	font-size: 14px;
	font-weight: bold;
	text-align: center;
	text-decoration: none;
	color: #858585;
	background: url(images/templatemo_menu.jpg) right bottom no-repeat;
}

#templatemo_menu_section ul li a.last{
	background: none;
}
#templatemo_menu_section li a:hover, #templatemo_menu_section li .current{
	color: #fff;

}

/* End Of Menu */

#templatemo_content_area {

	width: 950px;
	margin: 0;
	padding: 0;
	
}

#templatemo_left {
	
	float: left;
	width: 220px;
	margin: 0;
	padding: 15px 0 0 0;
	
}

#templatemo_left .templatemo_left_section_box {
	
	width: 221px;
	margin: 0 0 15px 0;
	padding: 0 ;
	
}

.templatemo_left_section_box .templatemo_left_section_box_top {
	
	width: 206px;
	height: 35px;
	background: url(images/templatemo_left_section_top.jpg) no-repeat;
	margin: 0;
	padding: 13px 0 0 15px;
	
}

.templatemo_left_section_box_top h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 0;
	padding: 5px 0 0 40px;
}

.templatemo_left_section_box .templatemo_left_section_box_mid {
	
	width: 191px;
	background: url(images/templatemo_left_section_mid.jpg) repeat-y;	
	margin: 0;
	padding: 10px 15px 0 15px;
	
}

.templatemo_left_section_box_mid p {
	font-family: Arial;
	font-size: 12px;
	color: #fff;
	text-align: justify;
	margin: 0 0 0 0;
	padding: 0 0 10px 0;

}

.templatemo_left_section_box .bottom_padding {
	padding: 0;
	
}

.templatemo_left_section_box_mid  h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 10px 0 10px 0;
	padding: 5px 0 0 40px;
}

.templatemo_left_section_box .templatemo_left_section_box_bottom {
	
	width: 221px;
	height: 21px;
	background: url(images/templatemo_left_section_bottom.jpg) no-repeat;
	margin: 0;
	padding: 0;
	
}

#templatemo_middle {
	
	float: left;
	width: 455px;
	margin: 0;
	padding: 15px 15px 0 15px ;

}

#templatemo_middle .templatemo_middle_section_box {
	
	width: 455px;
	margin: 0 0 15px 0;
	padding: 0;
	
	
}

.templatemo_middle_section_box .templatemo_middle_section_box_top {
	
	width: 440px;
	height: 35px;
	background: url(images/templatemo_mid_section_top.jpg) no-repeat;
	margin: 0;
	padding: 13px 0 0 15px;
	
}

.templatemo_middle_section_box_top h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 0;
	padding: 5px 0 0 40px;
}

.templatemo_middle_section_box  .templatemo_middle_section_box_mid {
	
	width: 425px;
	background: url(images/templatemo_mid_section_mid.jpg) repeat-y;
	margin: 0;
	padding: 15px 15px 0 15px;
	
}

.templatemo_middle_section_box_mid p {
	font-family: Arial;
	font-size: 12px;
	color: #fff;
	text-align: justify;
	margin: 0 0 0 0;
	padding: 0 0 10px 0;

}

.templatemo_middle_section_box_mid img {
	
	float: left;
	margin: 0 5px 5px 0;
	padding: 0;

}

.templatemo_middle_section_box .bottom_padding {
	padding: 0;
	
}


.templatemo_middle_section_box_mid  h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 10px 0 10px 0;
	padding: 5px 0 0 40px;
}


.templatemo_middle_section_box  .templatemo_middle_section_box_bottom {
	
	width: 455px;
	height: 23px;
	background: url(images/templatemo_mid_section_bottom.jpg) no-repeat;
	margin: 0;
	padding: 0;
	
}

#templatemo_right {
	
	float: right;
	width: 245px;
	margin: 0;
	padding: 15px 0 0 0;
}

#templatemo_right .templatemo_right_section_box {
	
	width: 246px;
	margin: 0 0 15px 0;
	padding: 0 ;
	
}

.templatemo_right_section_box .templatemo_right_section_box_top {
	
	width: 231px;
	height: 35px;
	background: url(images/templatemo_right_section_top.jpg) no-repeat;
	margin: 0;
	padding: 13px 0 0 15px;
	
}


.templatemo_right_section_box_top h1 {
	
	height: 31px;
	font-family: Arial;
	font-size: 16px;
	color: #fff;
	background: url(images/templatemo_music_note.jpg) left no-repeat;
	margin: 0;
	padding: 5px 0 0 40px;
}


.templatemo_right_section_box .templatemo_right_section_box_mid {
	
	width: 216px;
	background: url(images/templatemo_right_section_mid.jpg) repeat-y;
	margin: 0;
	padding: 15px 15px 0 15px;
	
}

.templatemo_right_section_box_mid p {
	font-family: Arial;
	font-size: 12px;
	color: #fff;
	text-align: justify;
	margin: 0 0 0 0;
	padding: 0 0 10px 0;

}

.templatemo_right_section_box_mid ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.templatemo_right_section_box_mid li {
	font-family: Arial;
	font-size: 12px;
	color: #fff;
	text-align: justify;
	margin: 0 0 0 0;
	padding: 0 0 5px 0;

}

.templatemo_right_section_box .templatemo_right_section_box_bottom {
	
	width: 246px;
	height: 22px;
	background: url(images/templatemo_right_section_bottom.jpg) no-repeat;
	margin: 0;
	padding: 0;
	
}

#templatemo_bottom_bg {
	width: 100%;
	height: 200px;
	background: url(images/templatemo_bottom_bg.jpg) repeat-x;
	
}
#templatemo_footer {
	
	width: 950px;
	height: 120px;
	background: url(images/templatemo_footer.jpg) no-repeat;
	margin: 0;
	padding: 80px 0 0 0;
	
}

#templatemo_footer .templatemo_footer_section {
	
	width: 100%;
	margin: 0 0 10px 0;
	padding: 0;
	color: #fff;
	text-align: center;
	font-size: 12px;
}
.cleaner {
	clear: both;
	margin: 0;
	padding: 0;
	height: 0;
}
 
Hallo,

weist Du, wieso der Rahmen nicht größer wird? Er besteht aus mehreren Bildern.


Gruß
Frog33r
 
Es ist nicht nur auf das Bild bezogen. Auch den Umbruch beim Text macht es automatisch. Der Rahmen wird nicht breiter, nur höher, wenn ich z.b. mehr Text einfüge.

Und all das ändert nichts dran, dass ich nur den linken drittel ausfülle.

Wie gesagt - Grundkenntnisse habe ich, aber da half mir nicht mal Google weiter.
 
Hallo,

der Rahmen besteht aus einem oberen Bild (templatemo_mid_section_top.jpg) mit fester Höhe und Breite,
einem mittleren Bild (templatemo_mid_section_mid.jpg), der variabel in der Höhe und fest in der Breite ist und
einem unteren Bild (templatemo_mid_section_bottom.jpg) mit fester Höhe und Breite.

Deswegen wird der Rahmen auch höher, wenn du mehr Text einfügst.

Gruß
Frog33r
 
Zuletzt bearbeitet:
Templatemo_left_xxx bezeichnet doch die elemente, die original links sind? also bei disen divs?
 
Hallo,

ich habe die Links der Bilder aus der Original-Website kopiert, bei Deinem Beispiel ist es natürlich "_mid_".


Gruß
Frog33r
 
Frog33r schrieb:
Hallo,

@Daaron: So wie ich den Code geschrieben habe, verwende ich die Tabelle für einen tabellarischen Aufbau und nicht als Design. Wo ist das Problem?
Das was du gepostet hast sind 4 Zeilen á eine Zelle... Das sind, egal wie du es drehst, einfach keine tabellarischen Daten.
Tabellarische Daten sind sowas hier:
Hubraum: 1558ccm
Leistung: 100kW

Du hast einfach nur jegliche Semantik versaut. Das, was du geschrieben hast, wäre viel sinnvoller z.B. in Form von
HTML:
<article>
<section><h2>Überschrift 1</h2><p>Text zur Überschrift 1</p></section>
<section><h2>Überschrift 2</h2><p>Text zur Überschrift 2</p></section>
</article>


So. Und nun zum eigentlichen Problem hier:
Atreju93, warum tust du dir die Rahmen auf Basis von Bildern an? Warum nutzt du nicht einfach
Code:
div.rahmen
{
border: 1px solid #fff;
border-radius: 10px;
}
 
Zurück
Oben