zurück zur Startseite
  


Zurück XHTMLforum > (X)HTML und CSS > CSS
Seite neu laden Bitte um Hilfe - CSS und Prozentangaben

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 28.02.2011, 02:42
Neuer Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 28.02.2011
Ort: NRW
Beiträge: 10
sprefer befindet sich auf einem aufstrebenden Ast
Ausrufezeichen Bitte um Hilfe - CSS und Prozentangaben

Hallo zusammen,

ich bräuchte mal bitte Hilfe von Euch.

Ich sitze seit Stunden an ner CSS-Datei und versteh es einfach nicht.

Ich dachte bisher die Grundregeln soweit alle zu können, wurde eines Besseren belehrt *g*

Ok also Folgendes:

PHP-Code:
body {
    
margin:0;
    
padding:0;
    
border:0;            /* This removes the border around the viewport in old versions of IE */
    
width:100%;
    
background:#fff;
    
min-width:600px;        /* Minimum width of layout - remove line if not required */
                    /* The min-width property does not work in old versions of Internet Explorer */
    
font-size:90%;
}
{
    
color:#369;
}
a:hover {
    
color:#fff;
    
background:#369;
    
text-decoration:none;
}
h1h2h3 {
    
margin:.8em 0 .2em 0;
    
padding:0;
}
{
    
margin:.4em 0 .8em 0;
    
padding:0;
}
img {
    
margin:10px 0 5px;
}
#ads img {
    
display:block;
    
padding-top:10px;
}

/* Header styles */
#header {
    
clear:both;
    
float:left;
    
width:100%;
}
#header {
    
border-bottom:1px solid #000;
}
#header p,
#header h1,
#header h2 {
    
padding:.4em 15px 0 15px;
    
margin:0;
}
#header ul {
    
clear:left;
    
float:left;
    
width:100%;
    list-
style:none;
    
margin:10px 0 0 0;
    
padding:0;
}
#header ul li {
    
display:inline;
    list-
style:none;
    
margin:0;
    
padding:0;
}
#header ul li a {
    
display:block;
    
float:left;
    
margin:0 0 0 1px;
    
padding:3px 10px;
    
text-align:center;
    
background:#eee;
    
color:#000;
    
text-decoration:none;
    
position:relative;
    
left:15px;
    
line-height:1.3em;
}
#header ul li a:hover {
    
background:#369;
    
color:#fff;
}
#header ul li a.active,
#header ul li a.active:hover {
    
color:#fff;
    
background:#000;
    
font-weight:bold;
}
#header ul li a span {
    
display:block;
}
/* 'widths' sub menu */
#layoutdims {
    
clear:both;
    
background:#eee;
    
border-top:4px solid #000;
    
margin:0;
    
padding:6px 15px !important;
    
text-align:right;
}
/* column container */
.colmask {
    
position:relative;    /* This fixes the IE7 overflow hidden bug */
    
clear:both;
    
float:left;
    
width:100%;            /* width of whole page */
    
overflow:hidden;        /* This chops off any overhanging divs */
}
/* common column settings */
.colright,
.
colmid,
.
colleft {
    
float:left;
    
width:100%;            /* width of page */
    
position:relative;
}
.
col1,
.
col2,
.
col3 {
    
float:left;
    
position:relative;
    
padding:0 0 1em 0;    /* no left and right padding on columns, we just make them narrower instead 
                    only padding top and bottom is included here, make it whatever value you need */
    
overflow:hidden;
}
/* 3 Column settings */
.threecol {
    
background:#eee;        /* right column background colour */
}
.
threecol .colmid {
    
right:25%;            /* width of the right column */
    
background:#fff;        /* center column background colour */
}
.
threecol .colleft {
    
right:50%;            /* width of the middle column */
    
background:#f4f4f4;    /* left column background colour */
}
.
threecol .col1 {
    
width:46%;            /* width of center column content (column width minus padding on either side) */
    
left:102%;            /* 100% plus left padding of center column */
}
.
threecol .col2 {
    
width:21%;            /* Width of left column content (column width minus padding on either side) */
    
left:31%;            /* width of (right column) plus (center column left and right padding) plus (left column left padding) */
}
.
threecol .col3 {
    
width:21%;            /* Width of right column content (column width minus padding on either side) */
    
left:85%;            /* Please make note of the brackets here:
                    (100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
}
/* Footer styles */
#footer {
    
clear:both;
    
float:left;
    
width:100%;
    
border-top:1px solid #000;
}
#footer p {
    
padding:10px;
    
margin:0;


Das ist die komplette CSS. Nun sind da 3 Boxen mit Inhalt (col1-col3), die von colleft, colmid und colmask umschlossen werden.

Die Boxen col1 und col3 sind jeweils links und rechts in Prozentangaben.
Mein Problem: Die Boxen sind mir zu breit.

Ich habe versucht mit den Prozentangaben da rumzuexperimentieren, aber ständig zerhaut es da alles.

Wer kann mir helfen, die beiden äußeren Boxen kleiner zu machen?

Ich danke schon mal für die Mühe die ich Euch mache.

Gruß
Sprefer
Mit Zitat antworten
Sponsored Links
  #2 (permalink)  
Alt 28.02.2011, 04:43
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 28.01.2011
Beiträge: 338
Webcoder sorgt für eine eindrucksvolle AtmosphäreWebcoder sorgt für eine eindrucksvolle Atmosphäre
Standard

Hi sprefer

um effektiv helfen zu können, bräuchte man ein Link zu der Seite, so lässt sich nur mutmaßen.

Es fehlt der dazugehörige HTML-Quelltext und ich vermute, dass schon da ein Fehler drin steckt. Du positionierst die Divs mit einem left-Wert und "position:relative". Eigentlich ist die Angabe der Breite und jeweils ein "float:left" bzw. "float:right" ausreichend.

Das Ganze sieht dann so aus:
HTML-Code:
<div id="col_1"></div>
<div id="col_3"></div>
<div id="col_2"></div>
Code:
col_1 {
    float:left;
    width:10%;}
col_3 {
    float:right;
    width:10%;}
Die mittlere Div sollte sich dann automatisch anpassen.


Gruß
Webcoder
Mit Zitat antworten
Sponsored Links
  #3 (permalink)  
Alt 28.02.2011, 08:57
Neuer Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 28.02.2011
Ort: NRW
Beiträge: 10
sprefer befindet sich auf einem aufstrebenden Ast
Standard

Vielen Dank für die schnelle Antwort.

Also ich habe die Seite von hier her -> The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible.

Dort sieht man auch ein Bild wie die Boxen aufgebaut sind.

Der Quelltext zur HTML:

HTML-Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
	<title>The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible.</title>
	<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
	<meta name="description" content="The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
	<meta name="keywords" content="The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
	<meta name="robots" content="index, follow" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<link rel="stylesheet" type="text/css" href="screen.css" media="screen" />
</head>
<body>

<div id="header">
	<p><a href="http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts" title="Perfect multi-column liquid layouts - iPhone compatible">&laquo; Back to the CSS article</a> by <a href="http://matthewjamestaylor.com">Matthew James Taylor</a></p>
	<h1>The Perfect 3 Column Liquid Layout (Percentage widths)</h1>
	<h2>No CSS hacks. SEO friendly. No Images. No JavaScript. Cross-browser &amp; iPhone compatible.</h2>
	<ul>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm" class="active">3 Column <span>Holy Grail</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-3-column-blog-style.htm">3 Column <span>Blog Style</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-left-menu.htm">2 Column <span>Left Menu</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-right-menu.htm">2 Column <span>Right Menu</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-double-page.htm">2 Column <span>Double Page</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-full-page.htm">1 Column <span>Full Page</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-stacked-columns.htm">Stacked <span>columns</span></a></li>
	</ul>
	<p id="layoutdims">Measure columns in: <a href="http://matthewjamestaylor.com/blog/ultimate-3-column-holy-grail-pixels.htm">Pixel widths</a> | <a href="http://matthewjamestaylor.com/blog/ultimate-3-column-holy-grail-ems.htm">Em widths</a> | <strong>Percentage widths</strong></p>
</div>
<div class="colmask threecol">
	<div class="colmid">
		<div class="colleft">
			<div class="col1">
				<!-- Column 1 start -->
				<h2>Percentage dimensions of the holy grail layout</h2>
				<img src="perfect-3-column-dimensions.gif" width="350" height="370" alt="Three column layout dimensions" />
				<p>All the dimensions are in percentage widths so the layout adjusts to any screen resolution. Vertical dimensions are not set so they stretch to the height of the content.</p>
				<h3>Maximum column content widths</h3>
				<p>To prevent wide content (like long URLs) from destroying the layout (long content can make the page scroll horizontally) the column content divs are set to overflow:hidden. This chops off any content that is wider than the div. Because of this, it's important to know the maximum widths allowable at common screen resolutions. For example, if you choose 800 x 600 pixels as your minimum compatible resolution what is the widest image that can be safely added to each column before it gets chopped off? Here are the figures:</p>
				<dl>
					<dt><strong>800 x 600</strong></dt>
					<dd>Left &amp; right columns: 162 pixels</dd>
					<dd>Center page: 357 pixels</dd>
					<dt><strong>1024 x 768</strong></dt>
					<dd>Left &amp; right columns: 210 pixels</dd>
					<dd>Center page: 459 pixels</dd>
				</dl>
				<h2>The nested div structure</h2>
				<p>I've colour coded each div so it's easy to see:</p>
				<img src="perfect-3-column-div-structure.gif" width="350" height="369" alt="Three column layout nested div structure" />
				<p>The header, colmask and footer divs are 100% wide and stacked vertically one after the other. Colmid is inside colmask and colleft is inside colmid. The three column content divs (col1, col2 &amp; col3) are inside colleft. Notice that the main content column (col1) comes before the other columns.</p>
				<!-- Column 1 end -->
			</div>
			<div class="col2">
				<!-- Column 2 start -->
				<h2>No CSS hacks</h2>
				<p>The CSS used for this layout is 100% valid and hack free. To overcome Internet Explorer's broken box model, no horizontal padding or margins are used in conjunction with a width. Instead, this design uses percentage widths and clever relative positioning.</p>
				<h2>SEO friendly 2-1-3 column ordering</h2>
				<p>The higher up content is in your page code, the more important it is considered by search engine algorithms (see my article on <a href="http://matthewjamestaylor.com/blog/link-source-ordering-seo">link source ordering</a> for more details on how this affects links). To make your website as optimised as possible, your main page content must come before the side columns. This layout does exactly that: The center page comes first, then the left column and finally the right column (see the nested div structure diagram for more info). The columns can also be configured to any other order if required.</p>
				<h2>Full length column background colours</h2>
				<p>In this layout the background colours of each column will always stretch to the length of the longest column. This feature was traditionally only available with table based layouts but now with a little CSS trickery we can do exactly the same with divs. Say goodbye to annoying short columns! You can read my article on <a href="http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks">equal height columns</a> if you want to see how this is done.</p>
				<h2>No Images</h2>
				<p>This layout requires no images. Many CSS website designs need images to colour in the column backgrounds but that is not necessary with this design. Why waste bandwidth and precious HTTP requests when you can do everything in pure CSS and XHTML?</p>
				<h2>No JavaScript</h2>
				<p>JavaScript is not required. Some website layouts rely on JavaScript hacks to resize divs and force elements into place but you won't see any of that nonsense here. The JavaScript at the bottom of this page is just my Google Analytics tracking code, you can remove this when you use the layout.</p>
				<h2>Resizable text compatible</h2>
				<p>This layout is fully compatible with resizable text. Resizable text is important for web accessibility. People who are vision impaired can make the text larger so it's easier for them to read. It is becoming increasingly more important to make your website resizable text compatible because people are expecting higher levels of web accessibility. Apple have made resizing the text on a website simple with the pinch gesture on their multi-touch trackpad. Is your website text-resizing compatible?</p>
				<h2>No Quirks Mode</h2>
				<p>This liquid layout does not require the XML declaration for it to display correctly in older versions of Internet Explorer. This version works without it and is thus never in quirks mode.</p>
				<h2>No IE Conditional Comments</h2>
				<p>Only one stylesheet is used with this layout This means that IE conditional comments are not needed to set extra CSS rules for older versions of Internet Explorer.</p>
				<!-- Column 2 end -->
			</div>
			<div class="col3">
				<!-- Column 3 start -->
				<div id="ads">
					<a href="http://matthewjamestaylor.com">
						<img src="mjt-125x125.gif" width="125" border="0" height="125" alt="Art and Design by Matthew James Taylor" />
					</a>
				</div>
				<h2>Browser Compatibility</h2>
				<p>This 3 column liquid Layout has been tested on the following browsers:</p>
				<h3>iPhone &amp; iPod Touch</h3>
				<ul>
					<li>Safari</li>
				</ul>
				<h3>Mac</h3>
				<ul>
					<li>Safari</li>
					<li>Firefox</li>
					<li>Opera 9.25</li>
					<li>Netscape 9.0.0.5 &amp; 7.1</li>
				</ul>
				<h3>Windows</h3>
				<ul>
					<li>Firefox 1.5, 2 &amp; 3</li>
					<li>Safari</li>
					<li>Opera 8.1 &amp; 9</li>
					<li>Google Chrome</li>
					<li>Explorer 5.5, 6 &amp; 7</li>
					<li>Netscape 8</li>
				</ul>
				<h2>Valid XHTML strict markup</h2>
				<p>The HTML in this layout validates as XHTML 1.0 strict.</p>
				<h2>This layout is FREE for anyone to use</h2>
				<p>That's right, you don't have to pay anything. If you are feeling generous however, link back to this page so other people can find and use this layout too.</p>
				<h2>Centered menus compatible</h2>
				<p>This layout is fully compatible with my <a href="http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support">cross-browser compatible centered menus</a>.</p>
				<!-- Column 3 end -->
			</div>
		</div>
	</div>
</div>
<div id="footer">
	<p>This page uses the <a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm">Perfect 'Holy Grail' 3 Column Liquid Layout</a> by <a href="http://matthewjamestaylor.com">Matthew James Taylor</a>. View more <a href="http://matthewjamestaylor.com/blog/-website-layouts">website layouts</a> and <a href="http://matthewjamestaylor.com/blog/-web-design">web design articles</a>.</p>
</div>

</body>
</html>
Mit Zitat antworten
  #4 (permalink)  
Alt 01.03.2011, 04:11
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 28.01.2011
Beiträge: 338
Webcoder sorgt für eine eindrucksvolle AtmosphäreWebcoder sorgt für eine eindrucksvolle Atmosphäre
Standard

hi sprefer

man muss eigentlich nur die Prozentwerte der Boxen anpassen. Hier mal der relevante Teil der CSS-Datei mit schmaleren Seitenboxen (20% statt 25% so dass die Mitte von 50% auf 60% angewachsen ist)

Code:
/* 3 Column settings */
.threecol {
	background:#eee;	/* right column background colour */
}
.threecol .colmid {
	right:20%;		/* width of the right column */
	background:#fff;	/* center column background colour */
}
.threecol .colleft {
	right:60%;		/* width of the middle column */
	background:#f4f4f4;	/* left column background colour */
}
.threecol .col1 {
	width:56%;		/* width of center column content (column width minus padding on either side) */
	left:102%;		/* 100% plus left padding of center column */
}
.threecol .col2 {
	width:16%;		/* Width of left column content (column width minus padding on either side) */
	left:26%;		/* width of (right column) plus (center column left and right padding) plus (left column left padding) */
}
.threecol .col3 {
	width:16%;		/* Width of right column content (column width minus padding on either side) */
	left:90%;		/* Please make note of the brackets here:
				(100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
}
Sieh dir einfach an welche Werte ich wie geändert habe und passe sie deinen Bedürfnissen an.
Mit Zitat antworten
Antwort

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Dingend Hilfe benötigt bei CSS Boxen für eine Wetterseite! Web4Live CSS 2 13.07.2011 16:01
Benötige Hilfe :( Html / Css Problem? Stefanie CSS 9 17.05.2011 18:12
CSS Hilfe bei meiner Seite matschi CSS 10 27.05.2007 23:49
css hilfe victorwooten CSS 1 19.11.2006 13:15
CSS mit CSS Seiten verlinken !!! BRAUCHE HILFE !!!! beavis-2005 CSS 2 16.01.2006 17:10


Alle Zeitangaben in WEZ +2. Es ist jetzt 15:35 Uhr.