Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6594079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:45:51+00:00 2026-05-25T17:45:51+00:00

I am taking an HTML / Web Design course and just started it the

  • 0

I am taking an HTML / Web Design course and just started it the other week. Now this isn’t the first time I’ve done HTML, but I don’t really remember much of it. I am trying to put some Java Code onto one of my web pages, as a way of “showing my recent accomplishments”.

So what I’m looking for is a way to format a block of text, so that it retains all its white space / tabs.

<BODY>
    <h1> Java Code Samples! </h1>

    <P> Hello, and welcome to the java code sample section of my site. Here I will put some </P>
    <P> random samples of code that I have written and projects that I have completed </P>
    <br />
    <h3 align="left"> These are some random methods: </h3>
    <p>
    <i> //Returns index of item in other array
        //Efficiency ( O(N) )
        public static int getOtherIndex(String searchString, College[] searchTarget)
        {
            for(int i = 0; i < searchTarget.length; i++)
                if(searchString.trim().equalsIgnoreCase(searchTarget[i].nameOfSchool.trim()))
                    return i;

            return -1;
        }
    </i>
    </p>

</BODY>

I am trying to format the method in a way that retains the initial white space, but while using the italics tag to make it stand out.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:45:51+00:00Added an answer on May 25, 2026 at 5:45 pm

    You can use the <pre> tag to do this.

    It keeps the formatting the same.

    Example: http://jsfiddle.net/jasongennaro/JC9ej/

    Fyi… better to style the p tag than to use an i for italics.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me begin this topic by explaining my background experience with web design. I
I've been away from web design/development for a long, long now and have recently
I have a project where I am taking some particularly ugly live HTML and
I don't know much css or html, so I have a question about taking
Taking shs's question a step further... Why isn't all government sponsored software open source?
Taking advice from this post , I purchased a copy of 'The C Programming
Taking this article on classes and structs as an example: http://msdn.microsoft.com/en-us/library/ms173109.aspx namespace ProgrammingGuide {
Taking the jQuery framework for example, if you run code like this: $(document).ready(function init()
I'm interested in adding an HTML/web-browser based log window to my net-enabled device. Specifically,
First of all, this is my first attempt at a silverlight app and it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.