Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25770
    Is it possible to incorporate more than one style sheet on a page. Can you define certain sections of the webpage to that particular style sheet?

    I have a main style sheet that is for the majority of the website. However, I got a second style sheet for an advanced particular table that I want to use. I do not want this table to get mixed up with the rest of my tables.

    How can I define that certain part of the page to that particular style sheet?

    For Example: This is what the main style sheet code for the entire page looks like.

    <!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=iso-8859-1" />
    <title>Blah page</title>
    <meta name="description" content="Blah blah blah" />
    <meta name="keywords" content="blah blah blah " />
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
    I would like to add another style sheet for one specific part of this page. Please help. Also, if this is a php page, is my doc type and meta content correct as seen here?

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Code:
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="second-stylesheet.css" rel="stylesheet" type="text/css" />
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25770
    Thanks for that info! But how does it know when and where to use it on the page?

  5. #4
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    In the second stylesheet, for the table, you will use specific div and class names that are not used in any other CSS. These names will match what you use in your HTML for the table.

    You will place the link to the second stylesheet after the link to your main one in the <head> so it will override the first one for that particular table.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  6. #5
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    What Alphamare said. CSS external stylesheets are processed in descending order, so if there are conflicting styles, the second one will override the first one.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  7. #6
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25770
    Oh I see now. Sorry guys, I am kinda learning this css stuff. I was figuring it had something to do with the <div class= ""> Please take a look at my two CSS files here and see if you see anything that would confuse the browser. Also, what class name should I use to start this table with? Do I need to rename anything on the second one to make this link to that table? Here is the first css document that is used on all the pages:

    @charset "UTF-8";
    /* CSS Document */

    /* ------- Page Layout ----------*/
    body{
    padding:0 0px 0px 0px;
    margin:0px;
    font:12px/18px Arial, Helvetica, sans-serif;
    color:#918F8B;
    background:#fff url(images/body_bg.gif) 0 0 repeat-x;
    }

    td{
    font:12px/18px Arial, Helvetica, sans-serif;
    color:#918F8B;
    font-weight:normal;
    }

    div, h1, h2, h3, h4, p, img, ul, ol, li, form, input, textarea{
    padding : 0;
    margin : 0;
    }
    p{
    padding : 0 0 10px 0;
    margin : 0;
    }
    ul {
    list-style : none;
    }
    img {
    outline : none;
    border : none;
    }
    a {
    outline : none;
    text-decoration : none;
    }

    /*------------------- General --------------*/
    .fontSize14{ font-size:14px; line-height:18px;}
    .fontSize16{ font-size:16px; line-height:20px;}
    .fontSize18{ font-size:18px; line-height:24px;}
    .fontSize24{ font-size:24px; line-height:36px;}
    .blueText{ color:#118CD1;}
    .whiteText{ color:#fff;}
    .grayText{ color:#DAD9D9;}
    .blueLink{ color:#65ABCC; text-decoration:underline; }
    .blueLink:hover{ color:#000; text-decoration:none; }
    .yellowText{ color:#D17B00;}
    .whiteLink{ color:#fff; font-size:11px;}
    .whiteLink:hover{ color:#FE8E2F; font-size:11px; }

    .heading_1{
    font-size:20px;
    font-weight:bold;
    color:#686868;
    line-height:30px;
    text-transform:uppercase;
    }

    .heading_2{
    font-size:18px;
    font-weight:normal;
    color:#524141;
    line-height:28px;
    padding:0 0 15px 0;
    display:block;
    }

    .heading_3{
    font-size:18px;
    color:#12A39E;
    line-height:24px;
    display:block;
    padding:10px 0 20px 0;
    font-weight:normal;
    }

    .heading_4{
    font-size:16px;
    font-weight:bold;
    color:#34362E;
    line-height:18px;
    padding:3px 0 20px 35px;
    display:block;
    background:url(images/heading_arrow3.gif) left top no-repeat;
    }


    .whiteBg{ background:#fff;}
    /*------------------- Layout --------------*/

    #main{
    padding:20px 0 0 0;
    position:relative;
    margin:0 auto;
    width:984px;
    }

    #topBar{
    width:100%;
    position:relative;
    height:80px;
    }

    #logo{
    width:324px;
    float:left;
    height:80px;
    }

    #topMenuOuter{
    width:660px;
    float:right;
    height:52px;
    padding-top:28px;
    }
    #topMenuInner{
    width:660px;
    float:left;
    height:52px;
    background:url(images/top-menu-bg1.gif) 0 0 repeat-x;
    }
    #topMenu{
    width:650px;
    float:left;
    height:52px;
    overflow:hidden;
    padding:0 0 0 10px;
    background:url(images/top-menu-c1.gif) 0 0 no-repeat;
    }
    #topMenu ul{
    width:640px;
    float:left;
    height:44px;
    display:block;
    padding:8px 10px 0 0;
    background:url(images/top-menu-c2.gif) right 0 no-repeat;
    }
    #topMenu ul li{
    display:block;
    width:auto;
    float:left;
    height:44px;
    text-transform:uppercase;
    padding:0 3px 0 0;
    }
    #topMenu a{
    color:#fff;
    display:block;
    line-height:44px;
    padding-left:20px;

    background:url(images/tab.gif) 0 0 no-repeat;
    }
    #topMenu a span{
    padding-right:20px;
    display:block;
    cursorointer;
    background:url(images/tab.gif) right 0 no-repeat;
    }

    #topMenu a:hover, #topMenu a.active{
    color:#403131;
    display:block;
    line-height:44px;
    padding-left:20px;
    background:url(images/tab.gif) 0 bottom no-repeat;

    }
    #topMenu a:hover span, #topMenu a.active span{
    padding-right:20px;
    display:block;
    background:url(images/tab.gif) right bottom no-repeat;
    }

    #banner{
    width:984px;
    height:363px;
    background:url(images/banner.jpg) top left no-repeat;
    }
    #bannerContent{
    text-align:right;
    padding:300px 57px 0 0;
    }

    #main_block{
    width:984px;
    float:left;
    padding:20px 0 10px 0;
    }
    #leftPanel{
    width:258px;
    border-right:#E3DEDE 1px solid;
    }

    #services{
    width:228px;
    float:left;
    padding:0 0 30px 20px;
    }
    #news{
    width:248px;
    float:left;
    }
    #news h2{
    padding:0 0 20px 10px;
    }
    .newsContent{
    padding:0 0 5px 0;
    }
    .newsContent .date_block{
    padding:0 0 0 10px;
    font-size:16px;
    line-height:27px;
    font-weight:bold;
    color:#fff;
    }
    .newsContent .d{
    display:inline-block;
    background:#E08C08 url(images/date_corner.gif) 0 0 no-repeat;
    padding:0 10px 0 14px;
    }
    .newsContent .m{
    display:inline-block;
    background:#12A39E url(images/m_corner.gif) right 0 no-repeat;
    padding:0 14px 0 10px;
    }
    .newsContent .c1{
    width:247px;
    height:8px;
    overflow:hidden;
    background:url(images/news_c1.gif) 0 0 no-repeat;
    }
    .newsContent .c2{
    width:247px;
    height:8px;
    overflow:hidden;
    background:url(images/news_c2.gif) 0 0 no-repeat;
    }
    .newsContent .content{
    width:215px;
    color:#706E69;
    padding:20px 10px 20px 20px;
    border-left:#F3F3F3 1px solid;
    border-right:#F3F3F3 1px solid;
    }
    .newsContent a{ color:#12A39E; font-weight:bold; text-decoration:underline;}
    .newsContent a:hover{ color:#12A39E; text-decoration:none;}
    #boxOuter{
    width:725px;
    float:left;
    position:relative;
    padding-bottom:10px;
    border-bottom:#E3DEDE 1px solid;
    }
    .box{
    width:220px;
    float:left;
    padding:15px 0 0 20px;
    height:210px;
    border-right:#E3DEDE 1px solid;
    }
    .noBorder{ border:0px;}

    .boxHeading{
    padding:0 0 27px 0;
    }
    .boxContent{
    padding:0 25px 0 0;
    }
    .boxContent a{ color:#018ED5; font-weight:bold; text-decoration:underline; }
    .boxContent a:hover{ color:#999;}
    .boxHeading2{
    font-size:14px;
    font-weight:bold;
    color:#666666;
    line-height:18px;
    height:22px;
    padding:14px;
    background:#C5EB52 url(images/box_heading2.gif) left top no-repeat;
    }
    .boxHeading3{
    font-size:14px;
    font-weight:bold;
    color:#666666;
    line-height:18px;
    height:22px;
    padding:14px;
    background:#C5EB52 url(images/box_heading3.gif) left top no-repeat;
    }
    .boxHeading4{
    font-size:14px;
    font-weight:bold;
    color:#666666;
    line-height:18px;
    height:22px;
    padding:14px;
    background:#C5EB52 url(images/box_heading4.gif) left top no-repeat;
    }
    .boxBottom{
    width:725px;
    float:left;
    position:relative;
    padding:24px 0 0 0;
    }

    .boxBottomLeft_block{
    width:420px;
    float:left;
    padding:0 0 0 20px;
    }
    .boxBottom_content{
    color:#979A9F;
    padding:10px 0 20px 0;
    }
    .boxBotttom_content{
    color:#000000;
    padding:10px 0 20px 0;
    }
    .img_box_block{
    width:200px;
    color:#524141;
    text-align:left;
    }
    .img_box_block p{ padding:0 0 18px 0;}


    .moreLink{
    display:inline-block;
    line-height:26px;
    padding:0 0 0 10px;
    background:url(images/more_bg.gif) 0 0 no-repeat;
    }
    .moreLink span{
    color:#fff;
    font-weight:bold;
    display:inline-block;
    line-height:26px;
    padding:0 10px 0 0 ;
    cursorointer;
    background:url(images/more_bg.gif) right 0 no-repeat;
    }
    .moreLink:hover{
    display:inline-block;
    line-height:26px;
    padding:0 0 0 10px;
    background:url(images/more_bg.gif) 0 bottom no-repeat;
    }
    .moreLink:hover span{
    color:#fff;
    font-weight:bold;
    display:inline-block;
    line-height:26px;
    padding:0 10px 0 0 ;
    cursorointer;
    background:url(images/more_bg.gif) right bottom no-repeat;
    }

    .roundBoxContent{
    padding:10px 20px 0 0;
    }

    #featured_projects{
    width:245px;
    float:right;
    padding:24px 0 0 0;
    background:#F3F3F3 url(images/c1.gif) 0 0 no-repeat;
    }
    #projects_block{
    width:205px;
    margin:0 auto;
    position:relative;
    }
    #projects_block h2{
    padding:0 0 20px 0;
    }
    .projects{
    width:205px;
    float:left;
    clear:both;
    padding:20px 0 20px 0;
    background:url(images/divider.gif) 0 0 repeat-x;
    }
    .p_img{
    width:87px;
    float:left;
    height:66px;
    }
    .p_details{
    width:116px;
    float:left;
    color:#635C5C;
    line-height:15px;
    }
    .p_details a{ color:#018ED5; text-decoration:underline; }
    .p_details a:hover{ color:#018ED5; text-decoration:none; }
    .view_all_projects{
    width:245px;
    height:63px;
    position:relative;
    overflow:hidden;
    }





    .list{ padding:0 0 10px 0;}
    .list li{
    padding:0 0 6px 25px;
    display:block;
    color:#579BC2;
    text-align:left;
    font-weight:bold;
    background:url(images/arrow.gif) 0 5px no-repeat;
    }
    .list li a{ color:#54514D;}
    .list li a:hover{ color:#579BC2;}


    /*-------------------- footer ------------------------------*/
    #footer{
    width:100%;
    float:left;
    text-align:center;
    padding:44px 0 30px 0;
    margin-top:20px;
    background:#fff url(images/footer_bg.gif) top left repeat-x;
    }
    #footerInner{
    width:980px;
    margin:0 auto;
    text-align:left;
    position:relative;
    }
    #newsletter{
    width:250px;
    float:left;
    padding:0 0 0 10px;
    }



    #newsletter form{ width:223px; display:block; }
    #newsletter h2{ padding:0 0 18px 0 ; display:block; }
    #newsletterInputArea{
    width:223px;
    height:30px;
    background:url(images/newsletter_input_area.gif) 0 0 no-repeat;
    }
    #subscribe{ text-align:right; padding:8px 0 0 0;}

    #footerLogo{
    width:228px;
    float:right;
    }

    #footerMenu{
    width:470px;
    float:left;
    padding:0 0 0 20px;
    }

    #footerMenu ul{
    width:156px;
    float:left;
    display:block;
    }
    #footerMenu ul li.heading{
    font-size:18px;
    color:#090606;
    padding:0 0 10px 0;
    }
    #footerMenu ul li{ display:block; padding:0 0 3px 0;}
    #footerMenu a{
    color:#979A9F;
    display:block;
    padding:0 0 0 10px;
    background:url(images/bullet.gif) 0 7px no-repeat;
    }
    #footerMenu a:hover{ color:#000; text-decoration:underline;}

    /*_______________________*/
    .inner_block{
    width:725px;
    float:left;
    position:relative;
    }
    Here is the second one for the particular table that I want to be different.

    /*
    Add the following to your CSS file should you wish the cursor to
    "wait" while the script is processing the sort

    body.sort-active *
    {
    cursor:wait;
    }
    */

    body
    {
    padding:0;
    border:0;
    margin:0;
    text-align:center;
    font-size:12px;
    font-family: verdana,arial,sans-serif;
    color:#545454;
    min-width: 800px;
    }
    h2 span
    {
    font-variant:small-caps;
    }
    p a
    {
    font-weight:normal;
    outline:none;
    }
    p a:link,
    p a:visited
    {
    color:#333;
    text-decoration:underline;
    }
    p a:hover
    {
    color:#fff;
    text-decoration:none;
    background:#000;
    }
    p a:active
    {
    color:#000;
    text-decoration:underline;
    }
    code
    {
    font-family:'andale mono','lucida console','courier new',monospace;
    font-size:1em;
    }
    p
    {
    line-height:1.6em;
    margin:0 0 1em 0;
    }
    h1
    {
    font-weight:lighter;
    font-family:georgia, times new roman, times, georgia, palatino, serif;
    text-align:center;
    margin-top:0.6em;
    color:#000;
    font-size:2em;
    }
    h2
    {
    font-weight:lighter;
    font-family:verdana,arial,sans-serif;
    text-align:center;
    margin-top:1em;
    color:#333;
    text-transform:uppercase;
    letter-spacing:1px;
    font-size:1.2em;
    }
    h2 span
    {
    font-variant:small-caps;
    text-transform:none;
    }
    table
    {
    width: auto;
    padding: 0;
    margin: 0 auto 1.5em auto;
    border-left: 1px solid #C1DAD7;
    border-collapse:collapse;
    }


    .cs1
    {
    width:30em;
    }
    .cs2
    {
    width:20em;
    }
    .cs1 td,
    .cs2 td,
    #scientificNotation
    {
    text-align:right;
    }
    caption
    {
    padding: 0 0 5px 0;
    margin:0 auto;
    width:auto;
    font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    text-align: right;
    }
    th
    {
    font: bold 10px/22px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #4f6b72;
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    border-top: 1px solid #C1DAD7;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: left;
    padding: 8px 12px 4px 12px;
    background: #CAE8EA url(../media/bg_header.jpg) no-repeat;
    vertical-align:middle;
    }
    td.total
    {
    border-top: 0;
    border-left: 0;
    border-right: 1px solid #C1DAD7;
    background: none;
    text-align:right;
    font-weight:bold;
    text-transform:uppercase;
    letter-spacing:1px;
    }
    th.sortable,
    th.sortable-text,
    th.sortable-date,
    th.sortable-keep,
    th.sortable-date-dmy,
    th.sortable-numeric,
    th.sortable-currency,
    th.sortable-sortByTwelveHourTimestamp,
    th.sortable-sortIPAddress,
    th.sortable-sortEnglishLonghandDateFormat,
    th.sortable-sortScientificNotation,
    th.sortable-sortImage,
    th.sortable-sortFileSize,
    th.sortable-sortAlphaNumeric,
    th.sortable-sortEnglishDateTime

    {
    cursorointer;
    background: #CAE8EA url(images/bg_header_sortable.jpg) no-repeat;
    padding: 8px 12px 4px 16px;
    }
    th.forwardSort
    {
    background:#CAE8EA url(images/bg_header_down.jpg) no-repeat 0 0;
    }
    th.reverseSort
    {
    background:#CAE8EA url(images/bg_header_up.jpg) no-repeat 0 0;
    }
    table thead th.forwardSort a,
    table thead th.reverseSort a
    {
    color:#000;
    text-decoration:none;
    }
    /*
    These styles should be added when very long tables are expected
    th.sort-active
    {
    background:#CAE8EA url(../media/bg_header_sorting.jpg) no-repeat 0 0;
    cursor:wait;
    }
    th.sort-active a
    {
    color:#a80000 !important;
    cursor:wait;
    }
    */
    th a
    {
    text-decoration:none;
    color: #4f6b72;
    background:transparent;
    }
    td a
    {
    text-decoration:none;
    color:#239;
    background:transparent;
    }
    td img
    {
    margin:0 auto;
    border:3px solid #ddd;
    }
    td a:hover
    {
    color:#a84444;
    border-bottom:1px dotted #a80000;
    background:transparent;
    }
    td
    {
    font: normal 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    padding: 6px 12px 6px 12px;
    color: #4f6b72;
    }
    td.lft
    {
    text-align:left;
    }
    tr.alt
    {
    background: #F5FAFA;
    color: #797268;
    }

    /* Poor old Internet Explorer 6 has a bug that means we can't use background images for the table rows
    as it trys to download the image each and every time that it is used (which means a 1000 row table
    will produce 1000 http requests for the image in question) */
    tr[class="alt"] td
    {
    background: #F5FAFA url(images/td_alt.jpg) no-repeat;
    }
    td[class~="alt"]
    {
    background: #edf3f3 url(images/col_alt.jpg) no-repeat !important;
    }
    /* Poor old Internet Explorer won't see the next two rules either as it doesn't get :first-child */
    tbody tr.alt td:first-child
    {
    background: #F5FAFA url(images/bullet2.gif) no-repeat;
    font-weight:bold;
    }
    tbody tr td:first-child
    {
    background: #fff url(images/bullet1.gif) no-repeat;
    font-weight:bold;
    }
    /* Image free rules for Internet Explorer < 7 */
    * html tr.alt td
    {
    background-color:#F5FAFA;
    }
    * html tr td.alt,
    * html tr.alt td.alt
    {
    background-color:#edf3f3;
    }

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    If it's just one table, don't use a class (classes are for multiple elements). Use an ID.
    Code:
    <table id="unique-table-id">
    Then apply CSS specifically to that table ID.
    Code:
    table#unique-table-id {
        border:  1px solid #00CC00;
    }
    table#unique-table-id td {
         font-weight:  bold;
    }
    The one thing I saw on the surface (although it's 2AM here and I'm about to go to bed) is that you're using fixed font sizes. Besides being an accessibility issue, most browsers ignore fixed font sizes anyway, so you're better off using ems or percentages for font sizes (personally, I go the percentage route because I find it a bit more "precise" in relative terms).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  9. #8
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25770
    Thank you so much Game! You have been a huge help! I am really trying hard to understand this stuff and get good at it. I use to know alot years ago but I have found out that the majority of what I thought I knew was deprecated. LOL With so many years of not doing it and the deprecated tags, I basically got to learn this all over again.

    :-D


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:37 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com