_tina_ Posted October 2, 2009 Share Posted October 2, 2009 Hi, I have a paragraph of text in a <p> tag. I need part of it to be a different color i.e. This is white text. This is blue text. This is white text. Do you know how I can achieve this? Thanks Quote Link to comment Share on other sites More sharing options...
Hybride Posted October 2, 2009 Share Posted October 2, 2009 Through external or even internal CSS files. For example: <p style="color:white;">This is white text</p> <p style="color:blue;">This is blue text</p> If you want to reuse your styles, you can do this: p#white { color:white} p#blue{color:blue} <p id="white">This is white</p> <p id="blue">This is blue</p> More help at: W3Schools CSS Quote Link to comment Share on other sites More sharing options...
_tina_ Posted October 2, 2009 Author Share Posted October 2, 2009 Thank you, but won't that put each one on a new line? Thst i the problem I'm having. Thanks again. Through external or even internal CSS files. For example: <p style="color:white;">This is white text</p> <p style="color:blue;">This is blue text</p> If you want to reuse your styles, you can do this: p#white { color:white} p#blue{color:blue} <p id="white">This is white</p> <p id="blue">This is blue</p> More help at: W3Schools CSS Quote Link to comment Share on other sites More sharing options...
lostprophetpunk Posted October 2, 2009 Share Posted October 2, 2009 Through external or even internal CSS files. For example: <p style="color:white;">This is white text</p> <p style="color:blue;">This is blue text</p> If you want to reuse your styles, you can do this: p#white { color:white} p#blue{color:blue} <p id="white">This is white</p> <p id="blue">This is blue</p> More help at: W3Schools CSS That would modify the whole <p> tag. You could use this instead... <span style='color: #ffffff;'>White Text</span> Quote Link to comment Share on other sites More sharing options...
saltedm8 Posted October 2, 2009 Share Posted October 2, 2009 have not checked it, but I think this is right ( the principle is ) p #white { color:white} span p .blue{color:blue} <p id="white">This is white<span class="blue">This is blue</span></p> Quote Link to comment Share on other sites More sharing options...
sticks464 Posted October 2, 2009 Share Posted October 2, 2009 have not checked it, but I think this is right ( the principle is ) p #white { color:white} span p .blue{color:blue} <p id="white">This is white<span class="blue">This is blue</span></p> This is correct coding but can be simplified and use a class if reusing elsewhere on the same page <p class="white">This is white<span>This is blue</span></p> .white {color:white;} .white span {color:blue;} Quote Link to comment Share on other sites More sharing options...
saltedm8 Posted October 3, 2009 Share Posted October 3, 2009 have not checked it, but I think this is right ( the principle is ) p #white { color:white} span p .blue{color:blue} <p id="white">This is white<span class="blue">This is blue</span></p> This is correct coding but can be simplified and use a class if reusing elsewhere on the same page <p class="white">This is white<span>This is blue</span></p> .white {color:white;} .white span {color:blue;} very true, but I did that just in case the op wanted to add more colours or styles within the text Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.