I have a column in a table, which draws out info from a database. The column is 150px wide. I want it to remain this wide, even if one word is longer. What happens now is that if i put in a web address which is long, it makes the columner wider. I want to make it trunucate the url so that it ends after 150px has been reached and continues to the next line. If i have a word longer than 460px i will have the same problem.
Any solutions anyone? what do i need to add to make the code in the <a class....> fit into 150px and then continue to the next line if the word is longer?
Here is the relevant part of the code - <td width="150" valign="top">
-
-
<!-- Left Column -->
-
-
<a class="RelatedArticle" href="view.asp?ID=<%=trim(RS("ID"))%>"><%=trim(RS("fldTITLE"))%></a><br />
-
</td>
does anyone know what i need to add to the code or the table? i'm not html literate, and i use dreameaver 8 for designing, i only know the very basics.
thanks in advance
4 4650
Currently, there is no standard way to do this. IE has a proprietary CSS method called 'word-wrap' which will become part of the CSS3 standard when it gets finalized, but it does not work in other browsers.
Currently, there is no standard way to do this. IE has a proprietary CSS method called 'word-wrap' which will become part of the CSS3 standard when it gets finalized, but it does not work in other browsers.
<td class="aTitle" valign="top">
<!-- Left Column -->
<a class="RelatedA rticle" href="view.asp? ID=<%=trim(RS(" ID"))%>"><%=tri m(RS("fldTITLE" ))%></a><br /></td>
and on the css styles page i added
td.acolumn {
width: 150px;
overflow: hidden;
}
The actual data that needs trunucating is a url that is very long. it is drawn from the part of the code which contains the authors biodate and webaddress and email.
Here is more of the code in case it may be the problem, in not letting it work. the table 658 is split into 3 columns, the first column is 150px and the data comes after the "authors image" but before the "related article" links, which means it must be the part that begins "if DB to use =1" - <table width="658" align="center" cellpadding="2" cellspacing="0" border="0">
-
<tr>
-
-
<td class="aTitle" valign="top">
-
<!-- Left Column -->
-
-
-
<%IF NOT (NIMAGE = "" OR IsNUll(NIMAGE)) THEN%> <img src="<%=NIMAGE%>" width="60" height="50" vspace="8" border="1"/> <br />
-
<hr align="center" width="100%" size="1" style="color: gray;"/>
-
<%END IF%>
-
<img src="images1/related2.JPG" width="140" height="36" alt="" border="0" /><br />
-
<br />
-
<%
-
-
IF DB_TO_USE = 1 OR DB_TO_USE = 3 THEN
-
-
SQL = "SELECT ID, fldTITLE FROM nm_tbl_news WHERE ((fldACTIVE = 1) AND (Now() BETWEEN fldPOSTED AND fldEXPIRES)) AND (ID IN (SELECT fldCID FROM nm_tbl_relations WHERE fldPID = " & NID & "))"
-
-
ELSE
-
-
SQL = "SELECT ID, fldTITLE FROM nm_tbl_news WHERE ((fldACTIVE = 1) AND (GetDate() BETWEEN fldPOSTED AND fldEXPIRES)) AND (ID IN (SELECT fldCID FROM nm_tbl_relations WHERE fldPID = " & NID & "))"
-
-
END IF
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
WHILE NOT RS.EOF
-
-
RCOUNT = RCOUNT + 1
-
%>
-
-
<img src="images1/blackbullet.JPG" width="5" height="5" alt="" border="0" /> <a class="RelatedArticle" href="view.asp?ID=<%=trim(RS("ID"))%>"><%=trim(RS("fldTITLE"))%></a><br />
-
<% RS.MoveNext
-
-
WEND
-
-
RS.Close
-
-
Set RS = Nothing IF RCOUNT = 0 THEN%>There are no related articles.<% End If %>
-
<br /><br />
-
-
-
<!-- [ Left Column ] -->
i actually discovered the right code, that needs modifying, i didn't post it above, it was the wrong code.
Here is what i have at the present, and using your suggestionms, which doesn't chop the url, it still makes the table cell longer. Bear in mind the url that is pulled is like one very long word, it's a headache, what a silly problem
ive even tried adding the style from dreamweaver, to the "email" and "web address" part, but it still wouldn't chop the url and make it fit into 2 lines instead of extending the table cell.
< - td width="190" valign="top">
-
<!-- Left Column -->
-
-
-
<%IF NOT (BIO = "" OR IsNUll(BIO) OR IMAGE = "" OR IsNUll(IMAGE)) THEN%>
-
<div style="padding-right: 5px;padding-bottom: 5px;">
-
-
<img src="<%=IMAGE%>" width="60" height="50" vspace="4" border="1" align="left"/>
-
<%=BIO%><br />
-
-
<%IF NOT (WEB = "" OR IsNull(WEB)) THEN%><br /><A class="aColumn" target="_blank" href="<%=WEB%>"><%=WEB%></A>
-
<%END IF%>
-
<%IF NOT (EMAIL = "" OR IsNull(EMAIL)) THEN%><br />
-
-
<A class="aColumn" href="mailto:<%=EMAIL%>"><%=EMAIL%></A><%END IF%><hr align="center" width="100%" size="1" style="color: gray;"/>
and in my stylessheet i have added, - .aColumn { height: 20px; width: 150px; overflow: hidden; }
can anyone see what needs modifying? i need the very long url which is pulled out of the "web" asp code to fit into 2 lines, rather than extend the table cell like it's doing now
OK now i have some code, which chops the long url, to fit it into the 150px wide cell, as before it was making the cell wider. I used wordwrap.
It works, but what happens is that the url gets chopped, and the chopped bit, doesn't carry on in the next line. It works in the link though, but i'd like the whole link (url) to show, it can carry on the next line and line after if need be.
This is what im using, but on the page itself, the part which is [end/code] or something, shows on the webpage. I also note that the code works even if i don't add the vbscript part, so is it necessasry? Anyway this is the page code now
In the stylesheet: - [code language="VBScript"]
-
-
.aColumn { word-wrap: break-word; width: 150px; overflow: hidden; }
code on the webpage is: - <table width="760" align="center" cellpadding="2" cellspacing="0" border="0">
-
</p>
-
<tr>
-
<td width="155" valign="top">
-
<!-- Left Column -->
-
-
-
<%IF NOT (BIO = "" OR IsNUll(BIO) OR IMAGE = "" OR IsNUll(IMAGE)) THEN%>
-
<div style="padding-right: 5px;padding-bottom: 5px;">
-
<img src="<%=IMAGE%>" width="60" height="50" vspace="4" border="1" align="left"/>
-
<%=BIO%><br />
-
-
<%IF NOT (WEB = "" OR IsNull(WEB)) THEN%><br /><A class="aColumn" target="_blank" href="<%=WEB%>"><%=WEB%></A>
-
<%END IF%>
-
<%IF NOT (EMAIL = "" OR IsNull(EMAIL)) THEN%><br /><A class="aColumn" href="mailto:<%=EMAIL%>"><%=EMAIL%></A><%END IF%>
[/code]
do i leave the cell table as it is? the only problem now is that the last bit ( [/code]) shows on the webpagge, and that the chopped url doesn't show on the next line. It fits though, the cell doesn't widen now.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Thomas Mlynarczyk |
last post by:
Hello,
How can I make an <a> element (containing text only, styled to be a box with
a border) as big as the table cell in which it resides, *without* having
specified any width/height (neither fixed nor percentage) for this table
cell?
Sizing the element to 100% width and height does not work, as the parent
element's width and height are not specified. And yet, in this case at
least, the width and height of the table cell are very...
|
by: David |
last post by:
In the event handler for ItemCommand, I am trying to read text of cells in
the row programmatically, but can't get it working.
//this is what I have in InitializeComponent
this.dgList.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgList_Command);
//this is the event handler.
private void dgList_Command(object sender, DataGridCommandEventArgs e)
{
|
by: amitp |
last post by:
hi i'm using MS Word2003 for my VB application which is a report. The word documents contains tables and the cells inside the table contain some fields. My application replaces the field values with Values from database.
The problem i was getting is if the text length that is replaced is more than the cell length it was not displaying at all rather "Display Text Cannot Span More Than One Line" is displayed in that cell. I need to wrap the...
|
by: Max2006 |
last post by:
Hi,
I have a TreeView and this is my node style:
<asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false"
Width="100px" NodeSpacing="3px" />
The problem is the expand button (+) resides right at the middle of
multi-line text. Can I make the expand button top align instead of middle
align?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |