473,804 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSS specific for modular code- theory question

I have some modular code that is written for display purposes. It
contains inline CSS code. I originally thought about moving all the
inline code to a css file for use throughout the site- one css file
with all the site's code. However this would hurt the code's
portability throughout multiple sites. Does anyone know of a good
article (or does anyone have strong opinions) about how to organize
styles in modular code. The code in question is a ColdFusion component
(like ASP.NET), but I think this CSS topic can relate to any language.

So do I move the code to a central CSS file with documentation on the
styles or do I leave it be? Can I default to a css file first? I
think inline css always takes precedence.

thanks,

Don

Nov 23 '05 #1
4 1369
bb*****@gmail.c om wrote:

So do I move the code to a central CSS file with documentation on the
styles or do I leave it be? Can I default to a css file first? I
think inline css always takes precedence.

By all means document your styles. Place the primary stylesheet that
defines the overall style for the site in a standard location. Add
specific stylesheets for specific situations.
The last applicable style encountered wins.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Nov 23 '05 #2
bbcrock wrote:
I have some modular code that is written for display purposes. It
contains inline CSS code.


Take out the inline styles. Add lots and lots of classes and IDs -- more
than you could possibly want. Distribute your module with a sample
stylesheet that uses these classes and IDs.

For bonus points, give all your classes and IDs a common prefix. e.g.

<div id="bbcrockcode _ident_flibble" class="bbcrockc ode_wrapper">
<h1 class="bbcrockc ode_heading">Fo o</h1>
</div>

and make sure that this common prefix can easily be changed. e.g.

<?php
$prefix = "bbcrockcod e_";
$idprefix = "bbcrockcode_id ent_";

function printflibble ()
{
global $prefix, $idprefix; // globals are evil
print "<div id=\"{$idprefix }flibble\" "
. "class=\"{$pref ix}wrapper\">\n "
. " <h1 class="{$prefix }heading">Foo</h1>\n"
. "</div>\n";
}
?>

This will prevent clashes of class names, IDs etc when integrating your
module into some other site.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Nov 23 '05 #3
"Toby Inkster" <us**********@t obyinkster.co.u k> wrote in message
news:hu******** ****@ophelia.g5 n.co.uk...
bbcrock wrote:

For bonus points, give all your classes and IDs a common prefix. e.g.

<div id="bbcrockcode _ident_flibble" class="bbcrockc ode_wrapper">
<h1 class="bbcrockc ode_heading">Fo o</h1>
</div>

and make sure that this common prefix can easily be changed. e.g.

<?php
$prefix = "bbcrockcod e_";
$idprefix = "bbcrockcode_id ent_";

function printflibble ()
{
global $prefix, $idprefix; // globals are evil
print "<div id=\"{$idprefix }flibble\" "
. "class=\"{$pref ix}wrapper\">\n "
. " <h1 class="{$prefix }heading">Foo</h1>\n"
. "</div>\n";
}
?>
This is OT I know, but since I too smear PHP/HTML/CSS together, I will just
say I'd prefer to see:

<?php
define( 'PREFIX', "bbcrockcod e_" );
define( 'IDPREFIX', "bbcrockcode_id ent_" );

function printflibble ()
{
......
}
?>

which gets rid of the global statement and reduces the possibility of one's
globals getting accidently changed. The question of capitalizing the names
of globals is strictly a personal preference thing.
Nov 23 '05 #4
Toby Inkster wrote:
Take out the inline styles. Add lots and lots of classes and IDs -- more
than you could possibly want.


Oh... and then add some more.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Nov 23 '05 #5

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

Similar topics

2
3646
by: Dan Stromberg | last post by:
Is there already a pure python module that can do modular-arithmetic unit conversions, like converting a huge number of seconds into months, weeks... or a bandwidth measure into megabits/s or gigabits/s or megabytes/s or gigabytes/s, whatever's the most useful (ala df -h)? Thanks!
18
5644
by: Zero | last post by:
Hi, I am calculating an integer to the pwer of a large integer, e.g. 2^5000. It turns out that the result I always get is zero. I am sure that the result is too large to store in such type as u_int64_t and long int etc. My power function is as follows: for(i=0; i<5000; i++) result *= 2;
4
2310
by: Nick Goloborodko | last post by:
Hi, I'm in the process of conceptualizing a new ASP.NET application. I'm a relative newbie in ASP.NET / .NET in general, so any comments will be greatly appreciated. Basically i need to make my application as modular as possible, something along the lines of Mambo (PHP CMS System) Drupal (another PHP CMS) or something similar to these. What I'm thinking is to provide the following structure: core of the application includes essential...
12
2217
by: Don Huan | last post by:
Hi my job is to migrate our WinForms application to ASP.NET. This app was build very modular so every peace of code can be replaced by another "modul". There are 1 VS-solution with about 60 projects (dll's) in it. Now I have to design a Web-Client modul (actually the web-interface). To maintain the modularity, I thought of making one ASP.NET-Project inside of the solution and create some projects containing Custom Web Controls. Did...
26
4861
by: I_AM_DON_AND_YOU? | last post by:
This is the scenario: I have a VB.Net project comprising of a few Forms. On Form1 I have more than 20 buttons. There is a very lenghty code written in click event of each and every button. Right now I haven't used any sub procedure. I mean to say I am writing the code directly in the click event. So it's become very lengthy and therefore to figure out some problem or make any changes I have to scroll at lot. Also in addition to click...
20
6829
by: Tuvas | last post by:
I have made and recently posted a libary I made to do Modular Arithmetic and Prime numbers on my website at http://www.geocities.com/brp13/Python/index.html . I am currently in a crypotology class, and am working on building a RSA public key cryptology system for a class project. I am building the librarys just to get the experience to do so. However, I would ask if any of you know of any gaping security holes that can easily be seen from...
2
1800
by: Tyno Gendo | last post by:
I'm writing a test "modular site". So far I have created an App class, a Module Manager class and a couple of test modules. The Manager looks in a directory called 'modules' and then for every ..php file is try to create a class of type <filenameminus the .php, so eg. for testmodule.php it tries to create a class "testmodule" and puts it into an array within the module manager called $_modules Module Manager has a dispatch_message...
1
3039
by: mattgarvin | last post by:
Hello, my company hosts many websites, and we want to add a Feedback Form (like "Contact Us") that can be re-used on all of them just by "dropping in" a new directory containing the code. My boss told me to make it as modular as possible, and to make it a control we can just drag on to a page. Then he went on vacation for a week. :) I have been reading about web.config files, and thought I could utilize one to contain the few items...
16
5840
by: Nkhosinathie | last post by:
hi, i'm writing a program that is using 4 arrays of pointers to char,called article,noun,verb and preposition.the program should create a sentence by selecting a word at random from each array in the following order:article,noun,verb preposition,,article and noun.as each word is picked,it should be concatenated to the previous words in an array that is large enough to hold the entire sentence. the words should be separated by spaces.when the...
1
2410
by: bob | last post by:
I have made a file: box.h that have some structs, simple functions etc. I have then made another file: print.h that have a class 'print' with methods to print the content from 'box' (content of various structs, fields etc) which currently does not work. in box.h I write: #include "print.h"
0
9714
marktang
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...
0
10599
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, 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...
0
10346
jinu1996
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...
1
10347
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,...
0
10090
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 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...
0
9173
agi2029
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...
1
7635
isladogs
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...
0
6863
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();...
3
3001
bsmnconsultancy
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...

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.