Results 1 to 4 of 4

Thread: Apply formatting to first letter of paragraph

  1. #1
    Join Date
    Nov 2006

    Question Apply formatting to first letter of paragraph

    Hi everyone, I have a query regarding in having the 1st letter of the paragraph 2pt's larger. I have got the CSS code below and it works fine, however, I have changed my layout and I am using a 2 column 3 row layout. Help to this tutorial I managed to get it working (http://www.htmlgoodies.com/beyond/cs...e.php/3642151).

    But now since I have several <div> ID's I want to select only my centre content area to apply this rule to. I have managed to get it working before when I had the page organised in a table format but since i've migrated to pure css and no tables then this text seems to not work and when it does it makes all the letters/words bigger. I'm only after making the 1st letter of the paragraph 2pt's larger for appearance.

    I have tried by removing my <p> tags where I have the text and replacing it all with <div> tag but i'm not sure if this should apply to text or only to structure the layout content. I have an external css file controlliong all the styles.

    This is the code I have used in my CSS for the first letter to have formatting applied:

    p:first-letter {
    font-style: italic;

    now in regards to my normal code for the page:

    <!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">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Joe's Fruit Shop - Joe's History</title>

    <link href="../joe_style.css" rel="stylesheet" type="text/css" />

    <div id="wrapper">
    <div id="header">
    <div align="center"><img src="../images/joes_header.jpg" alt="Joe's Fruit Store" width="482" height="42"/></div>
    <div id="content">
    <div id="content-left">
    <p><img src="../images/berry01_red.gif" alt="Fruit" width="22" height="20"/></p>
    <p><a href="http://users.chariot.net.au/~ajanusz/index.html">Home</a></p>
    <p><img src="../images/berry01_red.gif" alt="Fruit" width="22" height="20"/></p>
    <p><a href="http://users.chariot.net.au/~ajanusz/html/produce.html">Produce</a></p>
    <p><img src="../images/berry01_red.gif" alt="Fruit" width="22" height="20"/></p>
    <p><a href="http://users.chariot.net.au/~ajanusz/html/history.html">History</a></p>
    <div id="content-main">
    <h2>Joe's History</h2>
    <p>Joe's Fruit and Vegetables started out as a traditional store selling fruit and vegetables, along with other commodity items such as milk, soft drinks, sweets etc. Joe&amp;rsquo;s has been in business for 27 years and has a reputation for the quality of their goods.</p>
    <p>The proprietor, Joe Bashir, has discovered that there are many people who, through work schedules and home lifestyles, don&rsquo;t have the opportunity to shop in person.</p>
    <p>For convenience, they did fruit and vegetable shopping at supermarkets, but were not happy with the quality of the produce from the supermarkets. Joe wants to tempt these customers back by taking his store to them, in their homes.</p>
    <hr />

    <div id="footer">
    | <a href="http://users.chariot.net.au/~ajanusz/html/copyright.html">Copyright</a> | <a href="http://users.chariot.net.au/~ajanusz/html/privacy.html">Privacy</a> | <a href="mailto:info@joes.com.au?subject=Joe%27s%20Website%20Query"> Web Administrator</a> |

    <div id="bottom"></div>



    Can anyone take a look at it and let me know if I should remove all the <p> tags and replace them with the <div> tag?

    This is my css for the layout:

    body {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12pt;
    background-color: #FFFFFF;
    color: #006600

    h2 {
    color: #006600;
    text-align: center;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 16pt;

    #wrapper {
    margin:0px auto;
    text-align: left;
    border:1px solid #bbb;

    #header {
    border:1px solid #bbb;

    #content {

    #content div {
    border:1px solid #bbb;

    #content-left {
    text-align: center;

    #content-main {

    #footer {
    border:1px solid #bbb;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10pt;
    text-align: center;


    #bottom {

    a:link {
    color: #006600;
    text-decoration: underline;

    a:visited {
    color: #33CC00;
    text-decoration: underline;

    a:hover {
    color: #FFFFFF;

    a:active {
    color: #FF0000;
    text-decoration: none;

    Does anyone know how to actually write the css code differently so it only applies to my #content-main layer and only to the first letter on the page?

  2. #2
    Join Date
    Jul 2005
    Ah, you have much to learn about the mysteries of CSS... this will help you.

    I suggest you learn how semantics apply to X/HTML. Semantics is really a very important subject when it comes to X/HTML.

    I recommend that you read this as well: Writing Efficient CSS
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  3. #3
    Join Date
    Mar 2006
    Newcastle NSW Australia
    #content-main p:first-letter {
    font-size: 14pt;
    font-style: italic;


  4. #4
    Join Date
    Jan 2005
    If Centauri's doesn't work for you, you might try this: http://css.maxdesign.com.au/floatuto...torial0701.htm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.13602 seconds
  • Memory Usage 2,874KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates