_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 Link to comment https://forums.phpfreaks.com/topic/176298-text-color/ 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 Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929186 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 Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929187 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> Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929200 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> Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929218 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;} Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929370 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 Link to comment https://forums.phpfreaks.com/topic/176298-text-color/#findComment-929403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.