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 520293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:07:49+00:00 2026-05-13T08:07:49+00:00

In my web application I intend to shorten a lengthy string of HTML formatted

  • 0

In my web application I intend to shorten a lengthy string of HTML formatted text if it is more than 300 characters long and then display the 300 characters and a Read More link on the page.

The issue I came across is when the 300 character limit is reached inside an HTML tag, example: (look for HERE)

 <a hreHERE="somewhere">link</a>
 <a hre="somewhere">liHEREnk</a>

When this happens, the entire page could become ill-formatted because everything after the HERE in the previous example is removed and the HTML tag is kept open.

I thinking of using CSS to hide any overflow beyond a certain limit and create the “Read More” link if the text is beyond a certain number, but this would entail me including all the text on the page.

I’ve also thought about splitting the text at . to ensure that it’s split at the end of a sentence, but that would mean I would include more characters than I needed.

Is there a better way to accomplish this?

Note: I have not specified a server side language because this is more of a general question, but I’m using ASP.NET/C# .

  • 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-13T08:07:49+00:00Added an answer on May 13, 2026 at 8:07 am

    Extract the plaintext from the HTML, and display that. There are libraries (like the HTML Agility Pack for .NET) that make this easy, and it’s not too hard to do it yourself with an XML parser. Trying to fix a truncated HTML snippet is a losing cause.

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

Sidebar

Related Questions

I intend to make a web application that displays 3d environments that can be
I intend to build a web application where users can enter their time every
I am building a RESTFul web application using SpringMVC .For the html views, I
My web application sets session every time a user logs in. I checked that
The web application we are developing allows developers to do an HTTP POST from
In web application, I fetch the data from back end and the data is
The web application I'm working on serves up images with URLs like /image?name=a.gif. Pages
my web application supposed to send email reminders in some point it will send
My web application operates only over SSL and sets a time limited cookie for
My web application stores URL segments in a database. These URL segments are based

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.