Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling html text without CSS

I would like to html code part of my tumblr page, but in the context, I can't add any css. Is there any way to format text size, font, color, etc. without using css? I looked at <font> tags but they don't seem to be supported in html5. Is there a workaround or tag that would do this for me?

Thanks for all your help

like image 264
Samcfuchs Avatar asked Feb 22 '14 03:02

Samcfuchs


People also ask

How can you style an element in HTML without using CSS?

That is the easiest way and by doing so the code is in all one place, inside the head of the HTML file in a style tag, and can be edited easily. FYI Javascript functions can be added by placing them inside a '<script >alert("Hi , I'm in javascript");</script>' tag like above HTML code shows.

How do you change text style in HTML?

How to Change Font Type in HTML. To change font type purely with HTML, use the CSS font-family property. Set it to the value you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a paragraph, heading, button, or span tag.


4 Answers

With HTML alone, without any CSS, you can set

  • font family with <font face=...>
  • font size with <font size=...> (though just to a few values)
  • text color with <font color=...>
  • italic typefact with <i>
  • bold typeface with <b>
  • superscripts with <sup>
  • subscripts with <sub>
  • underlining with <u>
  • forced line breaks with <br>
  • allowed direct line break points with <wbr>
  • allowed hyphenation (word division) points with &shy;
  • no line breaks with <nobr>
  • text alignment in some elements with align attribute or (for vertical alignment) valign attribute
  • background color and/or image with bgcolor and background attributes in body element and in table-related elements
  • automatically scrolling text with <marquee>

and some other formatting tools (it is somewhat debatable what belongs to text formatting).

Although HTML5 drafts declare many of these as “obsolete” and “nonconforming”, they also require or strongly recommend (depending on element) that browsers continue supporting them, with the exception of nobr (which is well supported by browsers, with no signs of getting dropped).

(HTML5 is a draft specification. It does not “support” anything; browsers do. Specifications may require support, but that’s just a normative statement, about how things should be.)

If you can in fact use CSS at least in style attributes, then there are many more possibilities, though styling is then clumsy and limited.

like image 156
Jukka K. Korpela Avatar answered Oct 06 '22 19:10

Jukka K. Korpela


CSS in a separate file may not be the answer but you may be able to include it in the head of the HTML file like so:

    <doctype HTML>
    <html>
    <head> <title>My title</title>
        <style>h1{
            color:red;
            font-size:20px;
    }
        </style>
    </head>
    <body><h1>My large text heading</h1>
     <script>alert("Hi , I'm in javascript inside the HTML File");</script>
    </body>
    </html>

That is the easiest way and by doing so the code is in all one place, inside the head of the HTML file in a style tag, and can be edited easily. FYI Javascript functions can be added by placing them inside a '<script >alert("Hi , I'm in javascript");</script>' tag like above HTML code shows.

like image 39
Michael Mulvey Avatar answered Oct 06 '22 19:10

Michael Mulvey


Add CSS as a style directly to the tag you want to format.

EX.

<p style="width:20px;height:20px;background-color:#ffcc00;">The contents go here</p>

like image 8
Alexander Avatar answered Oct 06 '22 21:10

Alexander


You can also add <a href="thepagelink.html" style="text-decoration:none;"></a> This would remove the underline and any formatting on the link. You can then also add your own styling e.g <a href="thepagelink.html" style="text-decoration:none;" style="color: #07781C;"></a>

like image 1
keno Avatar answered Oct 06 '22 19:10

keno