How to create spacing and indentation using HTMLTextWriter?

I would like to ask how to create spacing and indentation using HTMLTextWriter. So far I have tried to use html.writeline();, but it does not work. Can anyone advise me on the codes? Thank.

Here is the code I have:

HtmlTextWriter html = new HtmlTextWriter(new StreamWriter(textBoxSave.Text)); //change to directory

html.RenderBeginTag("html");
html.AddAttribute("style", "background-color: white; color: black; font-size: small;");
html.WriteFullBeginTag("body");

html.WriteEndTag("body");    // body
html.RenderEndTag();    // html

html.Close();
+3
source share
3 answers

HtmlTextWriter provides two options for controlling indentation of output:

  • an argument tabStringfrom one of its constructors defining the actual line to be used for one level of indentation (for example, " "four spaces);
  • a property Indentthat contains the number of indent lines that will be displayed at the beginning of each line.

, HtmlTextWriter.

+3

  , .

0

, MVC, , . - - - . , - (, , , ..) , . :

  • - . , , -, .

  • , , .

  • , .

  • . , .

HTML, - CSS. , CSS ( , ), CSS Zen Garden.

You are using MVC, which generates HTML, but CSS should still handle the layout. I recommend starting with the W3 Schools HTML and CSS tutorials . Good luck.

0
source

Source: https://habr.com/ru/post/1782156/


All Articles