Styling html text without CSS

自闭症网瘾萝莉.ら 提交于 2019-12-18 16:53:10

问题


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


回答1:


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>




回答2:


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.




回答3:


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's 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.




回答4:


Great Question,

There are a couple ways that you could go about doing this. One way to go about doing this is by using inline css. Inline css looks like this: <p style="color:red">

The Second way about going this is by seeing if your template has advanced settings under the settings. There you can edit the css file and then reference it in the html!

The second way will save you tons of time and help your blog look nice!

Your Welcome,

Oak




回答5:


You may use the span style, div styles for styling the web page with out using cascading sheets.

Ex: <span style="color:#abc123;"> NAME </span>




回答6:


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>



来源:https://stackoverflow.com/questions/21949198/styling-html-text-without-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!