Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Framework Basics Prototyping with Bootstrap Adding a Dropdown Menu and Glyphicons

glyphs

Hello,

If glyphs are images, why are we using font-size, color, and text-align on them? I thought these styles were used on text only and not images?

.glyphicon{
    font-size:3em;
    display:block;
    text-align:center;
    color:#3a87ad;


    }
<!DOCTYPE html>
<html>
<head>
    <title>Ribbit - A Treehouse Project</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
    <link href="fonts/glyphicons-halflings-regular.svg" rel="stylesheet" media="screen">
    <link href="fonts/glyphicons-halflings-regular.eot" rel="stylesheet" media="screen">
    <link href="fonts/glyphicons-halflings-regular.ttf" rel="stylesheet" media="screen">
    <link href="fonts/glyphicons-halflings-regular.woff" rel="stylesheet" media="screen">
    <style>
    .container{
    max-width:1000px;

    }

    .glyphicon{
    font-size:3em;
    display:block;
    text-align:center;
    color:#3a87ad;


    }
    </style>
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="../../assets/js/html5shiv.js"></script>
      <script src="../../assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="navbar navbar-inverse">
    <div class="container">
         <div class="navbar-header">
            <a class="navbar-brand text-muted" href="#">Ribbit</a>
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>    
         </div>
         <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Home</a></li>
                <li><a href="#">About Ribbit</a></li>
                <li class="dropdown"><a data-toggle="dropdown" data-target="#" >Tree House <p class="caret"></p></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">About Treehouse</a></li>
                        <li><a href="#">Video Library</a></li>
                        <li><a href="#">Learning Adventures</a></li>
                        <li class="divider"></li>
                        <li><a href="#">Plans &amp; Pricing </a></li>


                    </ul>


                </li>
            </ul>

        </div>
    </div>
</div>
<div class="container">

        <div class="jumbotron">
            <h1>Self Destructing Application </h1>
            <p class="lead">Learn how to build this fun little app by signing up for a Treehouse account today! We'll teach you how to build both apps from scratch!</p>
            <p class="btn-group">
                <a class="btn btn-success btn-lg" href="#"> Download the app</a>
                <a class="btn btn-default btn-lg" href="#">Text me the link</a>
            </p>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <b class="glyphicon glyphicon-camera"></b>
                <h2>Delete photo &amp; video based on a timer</h2>
                <p>Learn how to write the code that downloads and displays messages, photos, and videos that timeout after a few seconds. Then create the code that deletes them from the back-end to make them "self destruct."</p>

            </div>
            <div class="col-sm-4">
            <b class="glyphicon glyphicon-user"></b>
                <h2>Build an easily managed friends list</h2>
                <p>Learn what Parse.com offers as a "backend-as-a-service" platform. Explore the user account management APIs provided by Parse.com and write the code to create and save a new user in a Parse.com data store.</p>
            </div>
            <div class="col-sm-4">
                <b class="glyphicon glyphicon-cloud"></b>
                <h2>Store &amp; retrieve data using cloud servers</h2>
                <p>We'll teach you how to upload images, video files, and messages to Parse.com's cloud servers. Then learn how to retrieve the data by setting up custom queries that download and display them in the app.</p>

            </div>

        </div>
        <div class="row">
            <div class="col-sm-6">
                 <h3>Learn how to make this app</h3>
                 <p>We will build on the concepts learned in previous iOS projects to create an app that will allow users to send photo or video messages to other users that will be deleted once viewed.</p>

            <div class="row">
                <div class="col-sm-6 col-sm-push-6">
                  <img class="img-responsive" src="img/thumb.jpg">
                </div>
                <div class="col-sm-6 col-sm-pull-6">
                  <p>Get access to these courses for only $24 a month!</p>
                  <p><a href="#">Visit Treehouse Now &raquo;</a></p>
                </div>
            </div>




            </div>

            <div class="col-sm-6">
                <h3>About Treehouse</h3>
                <p>Treehouse provides an extensive library of step-by-step video courses and training exercises that will give you a wide range of in-demand technology skills that will help you land your next dream job.</p>
                <a href="#">Sign up for Treehouse &raquo;</a>
            </div>


        </div>
        <hr>
        <footer>
            <p>&copy;2013 Ribbit - By Treehouse Island, Inc.</p>
        </footer>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

4 Answers

Hello, the glyphs are in font format, and that is why those styles can be used.

James Barnett
James Barnett
39,199 Points

The glyphs library is a neat thing called an icon font.

An icon font is a font file which instead of containing letters it has icons. Thus because it's a font it can use all of those nifty font-related CSS properties you mentioned.

VanSeo Design has a great article on the magic that is icon fonts

Unlike regular images (jpg, png, gif), font formats (woff, ttf, svg, eot) are scalable to any size without distortion. You can also give them color — sort of like in Photoshop. You can think of them more like the mathematical equivelent / equation of an image.

Here are some resources, and don't forget to check out the new Treehouse course Web Typography :smiley:.

What does it mean to be in the font format? cheers!

Yves Roulin
Yves Roulin
4,452 Points

That accept font styles (like font-size etc..)