1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

CSS how to change font size

Discussion in 'Web Development' started by rndm227, Oct 5, 2010.

  1. rndm227

    rndm227 New Member

    How do you change the font size in the body text here:

    body
    {
    margin: 0 auto;
    padding: 0;
    font-size: 62.5%; /* Resets 1em to 10px */
    font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    background-color: #FFFFFF;
    background-image: url('images/Page-BgTexture.png');
    background-repeat: repeat;
    color: #000000;
    }
    h2
    {
    font-size: 18px;
    }
    .Main
    {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    }
    table, th, td
    {
    font-size: 1em;
    padding: 0;
    border-collapse: collapse;
    }
    a img
    {
    border: 0;
    }
    a
    {
    color: #546A2F;
    }
    a:link
    {
    color: #546A2F;
    }
    a:visited
    {
    color: #35431E;
    }
    a:hover
    {
    color: #03AC6B;
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    body
    {
    margin: 0 auto;
    padding: 0;
    font-size: 62.5%; /* Resets 1em to 10px */
    font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    background-color: #FFFFFF;
    background-image: url('images/Page-BgTexture.png');
    background-repeat: repeat;
    color: #000000;
    }

    Increase/ decrease the percentage or use "px" ie., 10 px 24px 72px or use "em"
    "Percent" and "em" are scalable good for web pages to be based on scalable designs. Pixels ("px") or points are fixed size.
     
  3. rndm227

    rndm227 New Member

    I did those things and it didn't change. However, I was able to change it in .BlockContent-body. I was unable to post all the code before.
    Thanks!
     
  4. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    A style sheet is made up of rules. Each rule begins with a selector. A selector is normally one or more HTML elements (tags), and the declarations inside the rule describe how those elements should appear.
    Element selectors apply to every instance of that element.

    But suppose you want to specify a rule that applies only to specific instances of an element? In the case of the missing code ".BlockContent-body".
    This is where class selectors come in. HTML4 introduced the class attribute, which enables you to identify specific classes of elements. So every time you use ".BlockContent-body" it will over ride the body selector.

    In short the body selector did work you just had a class selector with different attributes where you enclosed your text. Try putting text outside of ".BlockContent-body" look at it then change the size in the css and look at it again.
    An example would be a sheet of paper and all the text is black, arial, 12px, but in the middle of the paper you want red, arial bold, 24px. So you create a class selector with those attributes and call it ".BlockContent-body".
     
  5. rndm227

    rndm227 New Member

    Thanks! I'm learning this. Just need it to stick.