I have a <spanof width X px and height Y px. I want to read the text
of an article, which is stored in a mySQL table, and pass to that
<spanonly just enough text to fit in it, along with a 'read more'
hyperlink which will take the user to the full article. I do not want
any overflow scroll bars to show. The font-size is set by external
stylesheet in em's.
How can I determine how much text is enough?
Approaches I've thought of:
-just set a semi-arbitrary number of characters, rounded to the
nearest full word, which allows the text to fit in the given space in
all browsers. Of course this approach won't take into account if the
user sets his browser's font size larger than usual.
-establish a table with em values for each character in a given font.
Calculate the width of each line of text by adding up the em values,
character by character, including letter spacing. Convert to pixels.
Compare to the allowed pixel width of each line. Do the same for
height, using line height instead of character width. Sounds like a
lot of work, though!
I've googled endlessly and haven't come up with very many ideas on how
to work this through...
anyone have any bright ideas? thx in adv 1 6051 ry****@gmail.co m wrote:
I have a <spanof width X px and height Y px. I want to read the text
of an article, which is stored in a mySQL table, and pass to that
<spanonly just enough text to fit in it, along with a 'read more'
hyperlink which will take the user to the full article. I do not want
any overflow scroll bars to show. The font-size is set by external
stylesheet in em's.
How can I determine how much text is enough?
Approaches I've thought of:
-just set a semi-arbitrary number of characters, rounded to the
nearest full word, which allows the text to fit in the given space in
all browsers. Of course this approach won't take into account if the
user sets his browser's font size larger than usual.
-establish a table with em values for each character in a given font.
Calculate the width of each line of text by adding up the em values,
character by character, including letter spacing. Convert to pixels.
Compare to the allowed pixel width of each line. Do the same for
height, using line height instead of character width. Sounds like a
lot of work, though!
I've googled endlessly and haven't come up with very many ideas on how
to work this through...
anyone have any bright ideas? thx in adv
You can't. For that to work, you would have to control the font size on
the user's browser. And you can't do that with PHP. For instance, I'm
getting old, so when I use a high-res monitor, I am often using a larger
font size than the default - which on Firefox also overrides any font
size you set.
Better would be to just pick a certain number of characters and let the
span adjust to fit them.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== === This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mikko Ohtamaa |
last post by:
From XML specification:
The
representation of an empty element is either a start-tag immediately
followed by an end-tag, or an empty-element tag.
(This means that <foo></foo> is equal to <foo/>)
From XHTML specification:
|
by: Catherine Lynn Smith |
last post by:
I am creating a webpage with dhtml <DIV> layers and I want a link on
one layer to modify the content on another but I seem to keep running
into errors.
Basically I create a layer in the middle of the screen that initially
comes up with a gif image of a house:
<!-- start "house" layer definition for center of screen -->
<DIV id="house" style="position:absolute; left:140px; top:137px;
width:510px; height:325px; z-index:2"><img...
|
by: Jim M |
last post by:
I have had great success with using <iframe> with overflow-y set to auto. I
can get a similar look with the <iframe> tag.
BUT... In all cases I need to have fixed heights. Is there a way to put
either tag inside an HTML <TD> and have the same kind of scrolling effect.
This would allow me to fill the screen and have the size of the scrolling
box change on resize.
Thanks in advance.
|
by: Wang, Jay |
last post by:
Hello, all,
I would like to enable some text between <SPAN
url="http://www.testserver.com/">WORD TO BE DRAGGED </SPAN>. I put some
javascript and it will extract http://www.testserver.com/ from the the span
element when I select the whole text in the SPAN and drag it.
However, I want to drag it without have to select the words between the span
element. The default mouse action will only select the words when i move the
mouse. Can...
|
by: Charlie T |
last post by:
Hello,
is there any way to get this to work?
myID.innerHTML = "Hello"
<DIV id="myID"></DIV>
<DIV id="myID"></DIV>
| |
by: hibernate |
last post by:
I'm somewhat new to javascript/DHTML, and this problem has been
plaguing me. I have made an 'array' of <div> tags within my html
document like so:
<div id="menu"> menu1 </div>
<div id="menu"> menu2 </div>
<div id="menu"> menu3 </div>
<div id="menu"> menu4 </div>
<span onclick="showOrHide('menu')"> show/hide menu1 </span>
|
by: Richard Maher |
last post by:
Hi,
I'm trying to use the Visibility Style attribute for a Div to effectively
PopUp a lightweight window with some additional context-sensitive
information, when a user mouses over a given field(s). The popping-up seems
to work just fine; it's the tearing down that's giving me grief. If I stick
a onmouseout event on the same input field that caused the
onmouseover/pop-up, it starts to flicker 'cos the <divis placed for
esthetically...
|
by: lilOlMe |
last post by:
I'm using Ajax to help make my webpage appear to be smoother.
When a control has submitted, I would like to prevent any controls within that control from resubmitting until the request has completed.
Because my forum has many buttons on it, it would take a long time to disable each one upon submitting the forum (using JavaScript).
So instead, I plan on using a <div> that will "shield" my buttons and prevent the user from clicking any...
|
by: todpeeple |
last post by:
Hi
can any one plz tell me urgently... is it possible to make round corners of any box (such as <div>, <span>,<table>, or any box) in asp .net page programatically or declareatively without using the graphic image... if yes then plz send me the code for that...
Regards
Tod
|
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: 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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |