Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
Title explains it all, please note I would just Google this but for some reason my computer is having a hard time connecting to the internet at the moment, so I had to write this on my phone with really awful web formatting.
EDIT: On a real computer now, to clarify I needed to set the text color of a string in an HTML document, preferably through CSS. Just something simple, like this:
<!DOCTYPE html>
<body>
The word <whatever styling here...>RED<end styling...> should be red!
</body>
I wasn't able to try much at the time I posted this, since my computer was having internet trouble, so I didn't really know what to do.
Try this
<span style="color: yourColor">your text</span>
<p style="color:red;">pizza</p>
in html
p{
color:red;
}
like that in css
for an inline style
<p style="color: blue"> text here </p>
if you want css with classes / ids ect..
put this in css file or in a script tag on your page:
.textColor
{
color: blue;
}
then add the class to the element
<p class="textColor"> text here </p>
<p class="attention"></p> in your html
.attention{
color:red;
}
in your css file, eg. my_styles.css which you include in the HEAD of your html, e.g.
<head>
<link rel="stylesheet" type="text/css" href="my_styles.css">
</head>
The above is if attention will appear more than once.
If it will never appear more than once you can use an id instead of a class, e.g.
<p id="attention"></p> in your html and
#attention{
color:red;
}
in your css file
You can use this
<font color='red' >your text here</font>
By this you can set the desired color for us text . You can also use the hexadecimal format here .
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed last month.
Improve this question
The code was just a practice for my html study and the image is not popping up like i want it to i want to know why.
<!DOCTYPE html>
<body>
<p>
<h1> This is ur mom texting </h1>
<p>hello human of the world this is your mom and i disapoprove of you all</p>
this the link
<p>
<img src="f7e55d6f07a6f29a827017134ccc6321.jpg" alt=https://www.google.com width"100" height"100" >
</p>
</body>
Use this instead
<img src="f7e55d6f07a6f29a827017134ccc6321.jpg" alt="https://www.google.com" width="100" height="100" >
Yhe syntax of an attribute is as follows
attributeName="value"
Note the " and the =
src must lead to an image, not just the name of the image
you have to give the link to the image depending on where the HTML file is located
So I supposed that your image is in the same place as the HTML file
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm not quite sure what's going on, but I don't want any text underline on my website and for some reason, it just got added automatically... any of you know how to fix it?
Is it because of the browser? The Stylesheet.css?
I'm really confuse since some of them are fine and other aren't...
Any help is really appreciated.
Thanks
This is the website: cliniquedukine.com
you are using u tag in cliniquedukine.com
you are code:
<u>410, 733 Boulevard Saint-Joseph <br> Gatineau, Québec <br> J8Y 4B6</u>
The default value of u tag is text-decoration: underline in chrome
So You have to redefine style of u tag.
you will do:
<u style="text-decoration: initial;">410, 733 Boulevard Saint-Joseph <br> Gatineau, Québec <br> J8Y 4B6</u>
another method:
you are redefine u tag in stylesheet.css
u {
text-decoration: initial;
}
You have wrapped parts of your HTML markup with <u> elements which have a default style of text-decoration: underline; which comes from the user agent's default stylesheet.
I suggest amending the HTML markup to remove the <u> elements.
Found in your code
<u>---, --- ********* ****-***** <br> *, *<br> --- ---</u>
u = underline
Please link your code. Also in your stylesheet write this
a {
text-decoration: none;
}
see if that works
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am taking a web design class and the assignment is to ,make a basic text site with the following requirements link to external page
image embedded from a website.
bold
italics
carriage return
list
font color change
font face change
comments
title
Heading <h1> <h2> etc...
Before I turn it in I was wondering if the code is clean enough and where would rate it on a scale of 0 to 100?
<!DOCTYPE html>
<html>
<head>
<title>DJ Khaled key to success</title>
</head>
<!---https://twitter.com/djkhaled/status/649808000987865088-->
<style>
body {
background-image: url("http://i-cdn.phonearena.com/images/articles/168223- image/First-HTC-One-M9-wallpaper.jpg");
background-color: #cccccc;
background-size: 1400px 675px;
background-repeat: no-repeat;
}
</style>
<body>
<font color="#0099ff"face="arial" size="7"><i>The key to more success is coco butter!</i></font></br>
<img src="https://usatftw.files.wordpress.com/2015/12/khaled1.gif?w=1000http://i.imgur.com/qsoXB3G.gif> width="300" height="230">
<br><b>click the gif above for the key to success</B><br>
<h1>The keys to success -by DJ Khaled</h1>
<ol>
<li><b>The key is to make it.</b></li>
<li><b>Another one.</b></li>
<li><b>Key to more success is clean heart and clean face.</b></li>
<li><b>Smh they get mad when u have joy.</b></li>
<li><b>There will be roadblocks but we will overcome them.</b></li>
<li><b>You smart! You loyal! You're a genius!</b></li>
<li><b>Those that weather the storm are the great ones.</B></li>
<li><b>I changed a lot</b></li>
<li><b>They don't want you to jet ski.</b></li>
<li><b>I can deal with everything. I got the answer for anything.</B></li>
</body>
</html>
I want to point out some changes you can make that can improve your design and help with maintenance in the long run.
Indent your code appropriately. Most IDE/editors already do these for you.
Why do this?
- Easier to read and manage.
Use external cascading stylesheets instead of style tags or inline styles.
Why do this?
You keep your html files small and not bloated.
It is easy to maintain, you only have to go to that file as oppose to having to scroll and use find and replace features, if your html gets any bigger you'll be pulling your hair out especially if you have heavy nesting.
It is also a way to separate your presentation logic from your
markup.
The title of the page is grammatically wrong. It should be:
<title>DJ Khaled's key to success</title>
Here is a JSFIddle with the changes: JSFiddle
I have removed the css and put it in a seperate stylesheet.
I have changed the <B> tags to <b> tags. And also, your src tag had errors,and I have changed that.
Instead of <b> and <i> you should consider <strong> and <em> (they give the highlighted text some meaning, other than a bold and italicized section). Also the <font> tag is now deprecated and should not be used (if it's class requirement, you should comment that to your tutor).
Your <style> tag is outside of the <head>
And also some of your tags are using uppercase text while others are lowercase.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Ok so Here is some sample code I have:
<div id="Noah">
<font face="Times New Roman" size="2">
<b>John Miceahl</b><br />
Cool guy, over all cool guy<br />
youtube.com/JohnMiceahl
</font>
</div>
Even though I have the <b> tags in place, it is not showing up in bold! I'm sure there is a quick fix to this and I am doing something slightly wrong.
EDIT: ADDED LINK TO CSS CODE:
http://pastebin.com/3UzA8hUA
Just learn how to do it in non deprecated and way easier ways:
In your particular case, try this HTML
<div class="name_tag"><span>John Miceahl</span>
<p>Cool guy, over all cool guy</p>
<p>youtube.com/JohnMiceahl</p>
</div>
And then this CSS
.name_tag {
font-family:"Times New Roman", Georgia, serif;
font-size:12px;
}
.name_tag span {
font-weight:bold;
}
Now you can re-use .name_tag as many times as you want, and you can change span for a heading, like h3 or h4. Clean, easy and works 100 out of 100 times.
But again, try to learn some HTML5, at least the basics, you'll need it if you want to build web pages
Check fiddle
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Please help me determine which of the approach is better(having 2 classes in html tag or 2 classes with same property) and why?
Approach 1
<html><body>
<p class="redColor buttonHeight"> button Red</p>
<p class="blueColor buttonHeight"> button Blue</p>
</body></html>
.redColor{color:red}
.blueColor{color:blue}
.buttonHeight{height:10px}
Approach 2
<html><body>
<p class="redColorHeight"> button Red</p>
<p class="blueColorHeight"> button Blue</p>
</body></html>
.redColorHeight{color:red}
.blueColorHeight{color:blue}
.redColorHeight,.blueColorHeight{height:10px;}
Try making your classes more general and give them names implying their purposes instead of their implementation, Such as button-important and button-info. Calling a CSS class in very specific name like redButton isn't really a good practice.
I believe this is a better practice:
<p class="button button-important"> button Red</p>
<p class="button button-info"> button Blue</p>
.button {
height: 10px;
}
.button-important {
color: red;
}
.button-info {
color: blue;
}
It's all about which properties you want to extract as common. E.g. if all buttons in your app should be the same height, use an approach suggested by Itay. Place height def in style of button class. If it is not a case and you don't want to keep them exactly same height you can use the second approach.
Css gives us a classes and we shoul use them as a classes. I mean use them in similar way as classes in java. A class describes some common properties of objects. Here I see a button object. There is no color nor height object :-)
You can check for example twitter bootstrap framework. Just go to bootstrap page, open a DOM viewer in your favorite browser and analyse how there are particular "components" described by classes.