IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mise en page CSS Discussion :

Comment ajouter un style impression à ma feuille de style


Sujet :

CSS

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 90
    Par défaut Comment ajouter un style impression à ma feuille de style
    Bonjour,

    Voilà ma feuille de style

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
     
    /***********************************************/
    /* 2col_leftNav.css                            */
    /* Use with template 2col_leftNav.html          */
    /***********************************************/
     
    /***********************************************/
    /* HTML tag styles                             */
    /***********************************************/ 
     
    body{
    	font-family: Arial,sans-serif;
    	color: #333333;
    	line-height: 1.166;	
    	margin: 0px;
    	padding: 0px;
    }
     
    a:link, a:visited, a:hover {
    	color: #006699;
    	text-decoration: none;
    }
     
    a:hover {
    	text-decoration: underline;
    }
    /* overrides decoration from previous rule for hovered links */
     
    h1, h2, h3, h4, h5, h6 {
    	font-family: Arial,sans-serif;
    	margin: 0px;
    	padding: 0px;
    }
     
    h1{
     font-family: Verdana,Arial,sans-serif;
     font-size: 120%;
     color: #334d55;
    }
     
    h2{
     font-size: 114%;
     color: #006699;
    }
     
    h3{
     font-size: 100%;
     color: #334d55;
    }
     
    h4{
     font-size: 100%;
     font-weight: normal;
     color: #333333;
    }
     
    h5{
     font-size: 100%;
     color: #334d55;
    }
     
    ul{
     list-style-type: square;
    }
     
    ul ul{
     list-style-type: disc;
    }
     
    ul ul ul{
     list-style-type: none;
    }
     
    label{
     font: bold 100% Arial,sans-serif;
     color: #334d55;
    }
     
     
    /***********************************************/
    /* Layout Divs                                 */
    /***********************************************/
     
    #masthead{
    	margin: 0;
    	padding: 10px 0px;
    	border-bottom: 1px solid #cccccc;
    	width: 100%;
    }
     
    #navBar{
    	margin: 0 79% 0 0;
    	padding: 0px;
    	background-color: #eeeeee;
    	border-right: 1px solid #ccc;
    	border-bottom: 1px solid #ccc;
    }
     
    #content{
      float:right;
    	width: 75%;
    	margin: 0;
    	padding: 0 3% 0 0;
    }
     
     
    /***********************************************/
    /*Component Divs                               */
    /***********************************************/
     
    #siteName{
    	margin: 0px;
    	padding: 0px 0px 10px 10px;
    }
     
     
    /*************** #pageName styles **************/
     
    #pageName{
    	padding: 0px 0px 10px 10px;
    }
     
     
    /************* #globalNav styles **************/
     
    #globalNav{
    color: #cccccc;
    padding: 0px 0px 0px 10px;
    white-space: nowrap;
    }
    /* 'nowrap' prevents links from line-wrapping if there are too many to fit in one line
       this will force a horizontal scrollbar if there isn't enough room for all links
       remove rule or change value to 'normal' if you want the links to line-wrap */
     
    #globalNav img{
     display: block;
    }
     
     
    #globalNav a {
    	font-size: 90%;
    	padding: 0px 4px 0px 0px; 
    }
     
     
    /************* #breadCrumb styles *************/
     
    #breadCrumb{
    	font-size: 80%;
    	padding: 5px 0px 5px 10px;
    }
     
     
    /************** .feature styles ***************/
     
    .feature{
    	padding: 0px 0px 10px 10px;
    	font-size: 80%;
    }
     
    .feature h3{
    	padding: 30px 0px 5px 0px;
    	text-align: center;
    }
     
    .feature img{
    	float: left;
    	padding: 0px 10px 0px 0px;
    	margin: 0 5px 5px 0;
    }
    /* adjust margins to change separation between the feature image and text flowing around it */
     
     
    /************** .story styles *****************/
     
    .story{
    	clear: both;
    	padding: 10px 0px 0px 10px;
    	font-size: 80%;
    }
     
    .story p{
    	padding: 0px 0px 10px 0px;
    }
     
    td.storyLeft{
    	top: 5px;
    	left: 10px;
    	width: 150px;
    	height:350px
    }
     
    td.storyRight{
    	top: 5px;
    	right: 10px;
    	padding-left: 10px;
    }
     
     
     
    /************* #siteInfo styles ***************/
     
    #siteInfo{
    	clear: both;
    	border: 1px solid #cccccc;
    	font-size: 75%;
    	color: #cccccc;
    	padding: 10px 10px 10px 10px;
    	margin-top: 0px;
    }
    /* negative top margin pulls siteinfo up so its top border overlaps (and thus lines up with)
    	the bottom border of the navBar in cases where they "touch" */
     
    #siteInfo img{
    	padding: 4px 4px 4px 0px;
    	vertical-align: middle;
    }
     
     
    /************* #search styles ***************/
     
    #search{
    	padding: 5px 0px 5px 10px;
    	border-bottom: 1px solid #cccccc;
    	font-size: 90%;
    }
     
    #search form{
     margin: 0px;
     padding: 0px;
    }
     
    #search label{
    	display: block;
    	margin: 0px;
    	padding: 0px;
    }
     
     
    /*********** #navBar link styles ***********/
     
    #navBar ul a:link, #navBar ul a:visited {display: block;}
    #navBar ul {list-style: none; margin: 0; padding: 0;}
     
    /* hack to fix IE/Win's broken rendering of block-level anchors in lists */
    #navBar li {border-bottom: 1px solid #EEE;}
     
    /* fix for browsers that don't need the hack */
    html>body #navBar li {border-bottom: none;}
     
     
    /*********** #sectionLinks styles ***********/
     
    #sectionLinks{
    	position: relative;
    	margin: 0px;
    	padding: 0px;
    	border-bottom: 1px solid #cccccc;
    	font-size: 90%;
    }
     
    #sectionLinks h3{
    	padding: 10px 0px 2px 10px;
    }
     
    #sectionLinks a:link{
    	padding: 2px 0px 2px 10px;
    	border-top: 1px solid #cccccc;
    	width: 100%;
      voice-family: "\"}\""; 
      voice-family:inherit;
    	width: auto;
    }
     
    #sectionLinks a:visited{
    	border-top: 1px solid #cccccc;
    	padding: 2px 0px 2px 10px;
    }
     
    #sectionLinks a:hover{
    	border-top: 1px solid #cccccc;
    	background-color: #dddddd;
    	padding: 2px 0px 2px 10px;
    }
     
     
    /*********** .relatedLinks styles ***********/
     
    .relatedLinks{
    	margin: 0px;
    	padding: 0px 0px 10px 10px;
    	font-size: 90%;
    }
     
    .relatedLinks h3{
    	padding: 10px 0px 2px 0px;
    }
     
     
    /************** #advert styles **************/
     
    #advert{
    	padding: 10px 0px 0px 10px;
    	font-size: 80%;
    	border-top: 1px solid #cccccc;
    }
     
    #advert img{
    	display: block;
    }
     
     
    /************** #headlines styles **************/
     
    #headlines{
    	margin: 0px;
    	padding: 10px 0px 20px 10px;
    	font-size: 80%;
    }
     
    #headlines p{
    	padding: 5px 0px 5px 0px;
    }
    J'aimerai créer un style d'impression uniquement pour cette partie là

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
    /************** .story styles *****************/
     
    .story{
    	clear: both;
    	padding: 10px 0px 0px 10px;
    	font-size: 80%;
    }
     
    .story p{
    	padding: 0px 0px 10px 0px;
    }
     
    td.storyLeft{
    	top: 5px;
    	left: 10px;
    	width: 150px;
    	height:350px
    }
     
    td.storyRight{
    	top: 5px;
    	right: 10px;
    	padding-left: 10px;
    }
    Comment faire, merci d'avance.

    Cédric

  2. #2
    Membre chevronné
    Profil pro
    Inscrit en
    Février 2009
    Messages
    308
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 308
    Par défaut
    Bonjour,

    pour ajouter une feuille de style pour l'impression il faut :

    Dans ta page html, après les autres feuilles de style, tu ajoute une feuille de style en mentionnant le média tel que :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <link rel="stylesheet" type="text/css" href="print.css" media="print" />
    Et ensuite dans ta feuille de style "print" tu ajoute :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    /************** .story styles *****************/
     
    .story{
    	clear: both;
    	padding: 10px 0px 0px 10px;
    	font-size: 80%;
    }
     
    .story p{
    	padding: 0px 0px 10px 0px;
    }
     
    td.storyLeft{
    	top: 5px;
    	left: 10px;
    	width: 150px;
    	height:350px
    }
     
    td.storyRight{
    	top: 5px;
    	right: 10px;
    	padding-left: 10px;
    }
    Et ensuite tu vérifie dans les différent navigateur via l'aperçu avant impression

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 90
    Par défaut
    Merci Ethyde.

  4. #4
    Expert confirmé
    Avatar de 12monkeys
    Homme Profil pro
    Webmaster
    Inscrit en
    Novembre 2006
    Messages
    4 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Service public

    Informations forums :
    Inscription : Novembre 2006
    Messages : 4 093
    Par défaut
    Bonsoir

    On peut aussi faire plus simplement dans la feuille de style :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    /************** .story styles *****************/
     
    @media print {
       .story{
    	clear: both;
    	padding: 10px 0px 0px 10px;
    	font-size: 80%;
       }
     
       .story p{
    	padding: 0px 0px 10px 0px;
       }
     
       td.storyLeft{
    	top: 5px;
    	left: 10px;
    	width: 150px;
    	height:350px
       }
     
       td.storyRight{
    	top: 5px;
    	right: 10px;
    	padding-left: 10px;
       }
    }

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [WD-2010] Problème feuille de style & impression
    Par yanncdg dans le forum Word
    Réponses: 8
    Dernier message: 16/04/2013, 09h22
  2. [XSLT 2.0] appel conditionnel de feuilles de style dans une feuille XSL
    Par qouify dans le forum XSL/XSLT/XPATH
    Réponses: 1
    Dernier message: 23/02/2011, 16h52
  3. Comment puis ajouter une feuille de style avec Javascript
    Par pierrot10 dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 23/02/2010, 08h21
  4. Comment ajouter une ligne dans une feuille ?
    Par vacknov dans le forum Macros et VBA Excel
    Réponses: 14
    Dernier message: 15/11/2007, 07h30
  5. Comment placer du PHP dans une feuille de style
    Par psychoBob dans le forum Langage
    Réponses: 6
    Dernier message: 28/05/2006, 00h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo