3 replies [Last post]
crazytopu
Offline
Regular
Last seen: 15 years 46 weeks ago
Joined: 2004-09-20
Posts: 26
Points: 0

hi guys,

I need a little assistance.

the following page used some inline style to make a word red or underline. for example : <font color="red"> IBCS-PRIMAX </font> <font color="black"> Software BD LTD. </font>. It is certainly not a good way to decorate a page.
http://ibcs.kgbinternet.com/org/ipsb/jsp/mission.jsp

i know it's best to use CSS to decorate some character/word differently from the other part of the body's text. But I would highly appreciate if you could kindly write a simple CSS declaration dat would do the same trick.

if you want to take the above example [IBCS-PRIMAX in red and Software BD LTD in black bold] it would be easier for me to grasp the CSS code.

Thanks a ton.

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 7 years 2 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

A damn simple question..

There are quite a few ways to achieve your objective but two of the easiest to understand are:

(1) <span style="font-weight: bold; color: red;">IBCS-PRIMAX</span> <span style="font-weight: bold; color: black;">Software (Bangladesh) Ltd,</span> a Bangladesh-British...

(2) <span class="trade_name">IBCS-PRIMAX</span> <span style="full_name">Software (Bangladesh) Ltd,</span> a Bangladesh-British...

and then in the stylesheet:

.trade_name {
font-weight: bold;
color: red;
}
.full_name {
font-weight: bold;
color: black;
}

Life's a b*tch and then you die!

crazytopu
Offline
Regular
Last seen: 15 years 46 weeks ago
Joined: 2004-09-20
Posts: 26
Points: 0

A damn simple question..

thx roy,

I would go for the second example, that way what all i have to do is change just the class declaration.

I didnot quite understand why did you give the first example. It doesnot look any different from the problem I discussed, i.e bringing changes to the code line by line to make any necessary changes. What if i have used that color combination in 200 words? dont i have to change the code in 200 places to make a single change?

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 7 years 2 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

A damn simple question..

crazytopu wrote:

I did not quite understand why did you give the first example. It doesnot look any different from the problem I discussed, i.e bringing changes to the code line by line to make any necessary changes. What if i have used that color combination in 200 words? dont i have to change the code in 200 places to make a single change?

I was answering your question in a way that left you to decide which method was best for your requirements (not just for the example given). You did not say what you were trying to achieve, other than you wanted to use CSS. Obviously the second method is better if you are likely to want to change the formatting of multiple uses of the class in the future, but there may be cases where the first method is better (for example if you are writing the page using server-side script and are wanting to change bits of text formatting on-the-fly without having to play around with stylesheets. I thought I'd give you two solutions and let you decide which is best for your needs.

Life's a b*tch and then you die!