473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

putting CSS in functions or other solutions

I have the following style (bottom), which contains some php which provides
the left and top values. This style is incorporated into the html at the
bottom and controls the position of $heading1. Problem is I wish to use the
same style for heading2, heading 3 etc. However they all will have different
positions. I could create a separate style for each. but Im sure there must
be a way of using the same style.
I had the idea of putting the style in a php function such as

<?php function myfunction($posx, $posy){ ?>
..mystyle{
position:absolute; left:<?php echo $posx;?>px; top:<?php echo $posy;?>px;
}
<?php } ?>

but this didnt work. Help greatly appreciated. my current code is below
Ian
******************************
<style>
<!--
..txtposition{
position:absolute; left:<?php echo $xh1;?>px; top:<?php echo $yh1;?>px;
}
-->
</style>
<span class="txtposition">span class="drag"><?php echo $heading1
?></span></span>
************************************************** ****
Jul 31 '06 #1
1 1083

Ian Davies wrote:
I have the following style (bottom), which contains some php which provides
the left and top values.
Redesign to not need position:absolute. It's a whole world of pain to
deal with, it kills off fluid-design, and if you're having to generate
the position numbers dynamically, it's a strong indication that the
design is flawed.

Anything else is a PHP problem, OT in this ng. Try catching the HTML
output and validating / debugging that. You either have a CSS problem
here or a PHP problem in generating exactly what you want - unlikely to
be both causing trouble, so just chop the problem in half and fix the
half that needs it.

Jul 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
15
by: Xah Lee | last post by:
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); }
4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
6
by: junky_fellow | last post by:
what are reentrant functions? What are the characteristics of a reentrant code ? what things should be kept in mind while writing a reentrant code ?
3
by: Asfand Yar Qazi | last post by:
For years, I've been putting everything that won't be needed outside a compilation unit in anonymous namespaces, even editing my old files that did things the 'old' way (using static linkage). ...
4
by: mecej4 | last post by:
DB2 Express C (Fixpack 10, WR21362_15462) seems to be lacking some of the OLAP functions available in other editions, such as ROW_NUMBER, RANK and DENSE_RANK, but does provide sum(..) over...
5
by: jonkersbart | last post by:
Dear, I have wrote a script and want to group some functions of the script in a separate modulo so that I can import the module in other scripts and use the same functions there.. The problem...
27
by: Aaron Hsu | last post by:
Hey all, After seeing the Secure version I/O functions thread, it occured to me that maybe not everyone agrees with the almost universal adage that I have heard. I have Always been told that...
12
by: thegman | last post by:
Hi all, I'm trying to get list of JavaScript methods/functions in a script file in much the same a good text editor will, the difference being that I need to output it to a file or stdout, or some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.