PDA

View Full Version : Mi date una mano?


gik25
25-09-2003, 17:24
Visto che siete in gamba a usare il codice mi date una mano?
devo usare un css per abberviare una parte di codice html che ripeto mille volte: <font arial="" color="" size=""> vorrei sostituirla con qualcosa tipo: <mio1>.

La pagina web www.hyperreview.com si ridurrebbe da 50 Kb a 10 (più o meno)

Come faccio?

Marvel83
25-09-2003, 23:07
CSS??? campo minato....
Chiedi a walternet.... lui è fissato con i CSS...
YATTADE':D

gik25
25-09-2003, 23:55
Originariamente inviato da Marvel83
CSS??? campo minato....
Chiedi a walternet.... lui è fissato con i CSS...
YATTADE':D

perchè campo minato?

Marvel83
26-09-2003, 10:36
Perchè i CSS nn sono molto utilizzati...
Uno che ne sa molto su questi è walternet....sarà per lui un piacere aiutarti....
YATTADE':D

walternet
26-09-2003, 10:43
Presumo che il font sia lo stesso per tutto il sito, allora definiscilo così...

body {
font-family: verdana, arial, helvetica, sans-serif;
}

In questo modo tutto il <body> avrà lo stesso font.
Allo stesso modo puoi fare con <p> o con qualunque altro tag...

Per quanto riguarda il resto la cosa migliore è usare <h1><h2><h3> ecc... definendone le proprietà nel foglio di stile così per fare per esempio il testo di un titolo scrivi solo <h2>Titolo</h2>


Prova ad usare questo template modificandolo dove serve... è perfetto


body {
margin: 0;
padding: 0;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 76%;/* font sizing in ems, baby. if you want to change anything, just change this.*/
/*funny thing happens at 75% and lower. opera goes to a nice small size, but moz and ie pc change almost not at all. seems 76% is as small as you can go and stay the same across browsers. poop.*/
color: #000;
background-color: #fff;
background-image: url(http://www.thenoodleincident.com/img/_.gif);/*these three lines replace the n4_upgrade.gif in n4.css. and if you use this code, make sure you point to an img on _your_ server, not mine.*/
background-repeat: no-repeat;
background-position: top left;
}
#content {
margin: 0em;
padding: 4em 6em 2em 6em;/* use padding instead of margin for multicolumn layouts because of a really odd ie5pc bug where it sometimes relates the width of an unrelated menu div to this div. i'll, uh, write about that somewhere. it was hard to figure out what was causing it, so i want this note here to remind me. */
}

/*the following classes are to demonstrate better line heights for narrow columns*/
.narrow1{
width: 50%;
line-height: 1.3em;
}
.narrow2{
width: 50%;
line-height: 1.5em;
}

/*typography*/
a {
text-decoration: none;
font-weight: bold;
color: #000;
}
a:link {
}
a:visited {
}
a:active {
}
a:hover {
text-decoration: underline;
}
h1 {
font-size: 2.0em;
font-weight: normal;
margin-top: 0em;
margin-bottom: 0em;/*both set to zero and padding in header div is used intead to deal with compound ie pc problems that are beyound summary in a simple comment.*/
}
h2 {
font-size: 1.7em;
margin: 1.2em 0em 1.2em 0em;
font-weight: normal;
}
h3 {
font-size: 1.4em;
margin: 1.2em 0em 1.2em 0em;
font-weight: normal;
}
h4 {
font-size: 1.2em;
margin: 1.2em 0em 1.2em 0em;
font-weight: bold;
}
h5 {
font-size: 1.0em;
margin: 1.2em 0em 1.2em 0em;
font-weight: bold;
}
h6 {
font-size: 0.8em;
margin: 1.2em 0em 1.2em 0em;
font-weight: bold;
}
img {
border: 0;
}
ol, ul, li {/*
list-style: none;*/
font-size: 1.0em;
line-height: 1.8em;
margin-top: 0.2em;
margin-bottom: 0.1em;
}
p {
font-size: 1.0em;
line-height: 1.8em;
margin: 1.2em 0em 1.2em 0em;
}
li > p {
margin-top: 0.2em;
}
pre {/*moz 1.0/1.1/1.2.1, net 7.0/7.01 make this way too small, but i'm not going to go larger because monospace tends to run you into overflow pretty quick. prior moz and net are okay.*/
font-family: monospace;
font-size: 1.0em;
}
strong, b {
font-weight: bold;
}

Il risultato lo vedi qui
http://www.thenoodleincident.com/tutorials/typography/template.html

walternet
26-09-2003, 10:46
Dimenticavo... salva quel testo del messaggio precedente come stile.css e nelle pagine html scrivi all'interno dell'<head>

<style type="text/css" media="screen">@import url("stile.css");</style>

Poi per modificare tutto il sito lavori solo sul file stile.css

gik25
26-09-2003, 12:23
Grazie, dopo provo e magari ti chiedo qualche delucidazione