How to Convert Text to HTML and .Net
- 1). Create a new HTML file using Notepad or an HTML editor.
- 2). Add the following code to the document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
</body>
</html> - 3). Add this code after the first <head> tag:
<style>
.myText{color:Red; width:100%}
</style>
This is an inline Cascading Style Sheet (CSS). Developers use CSS to apply visual styles to elements on a Web page. In this example, the CSS class named ".myText" defines color and width properties. Any HTML element that references this class will be red. The element will also expand to the full width of the browser screen because the value for "width" is 100 percent. - 4). Add this code after the first <body> tag:
<div>
insert text here
</div>
The div tag define a block on an HTML page. You can place text and other elements within a set of div tags. The first tag named "<div>" begins the block and the second tag named "</div>" ends it. Replace "insert text here" with your own text. The text will be red because the div tag that contains the text references the CSS class named "myText." - 5). Save the HTML file and open it in a browser. Your text will be red.
- 1). Open Visual Studio.
- 2). Click "File" and select "New Web Site." A list of installed templates will appear.
- 3). Click the template named "ASP.NET Web Site" to select it. Click "OK" to open it in the editor. Visual Studio will insert basic HTML elements such a <body> and <head> into the document.
- 4). Place the following code after the <head> tag:
<style>
.myText{color:Red; width:100%}
</style>
This defines the .myText CSS class described in the previous section. - 5). Add this code after the <form> tag:
<div>
insert text here
</div>
In ASP.NET, all page elements must appear between <form> tags. Replace "insert text here" with your own text. - 6). Press "F5". Visual Studio will compile the application and display the ASP.NET page in your browser.