我可以用什么来代替 在 HTML 中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2005657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What can I use to substitute in HTML?
提问by Steven
is ugly, I think.
丑,我觉得。
回答by Noon Silk
Margin and/or Padding. (css properties), like so:
边距和/或填充。(css 属性),像这样:
<p style='padding-left : 10px'>Hello</p>
(It's worth noting that it's generally considered bad-practice to put an inline style like that; you typically declare a selector in an external css file and set the class/whatever appropriately.)
(值得注意的是,放置这样的内联样式通常被认为是不好的做法;您通常在外部 css 文件中声明一个选择器并适当地设置类/任何内容。)
回答by graphicdivine
In CSS try:
在 CSS 中尝试:
white-space:nowrap;
回答by YOU
In CSS, Add
在 CSS 中,添加
pre{
white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
}
<pre> is not ugly anymore </pre>
回答by Madalina Taina
I had this problem when I realised I will have empty tags. I didn't want to set a fixed height and it was to late to change the html. I wanted to add a space in the css, the substitute for  
, so I added the space before the element, using :before
(it needs to be specified via unicode).
当我意识到我会有空标签时,我遇到了这个问题。我不想设置固定高度,更改 html 为时已晚。我想在css中添加一个空格,代替 
,所以我在元素之前添加了空格,使用:before
(它需要通过unicode指定)。
p:before {
content: "H2 { word-spacing: 3pt }
a0";
}
Hope this solution helps someone. The solution with padding didn't work for my problem.
希望这个解决方案可以帮助某人。带填充的解决方案对我的问题不起作用。
回答by Jitendra Vyas
 
is alternative but it's also ugly
 
是另一种选择,但它也很丑
Beautiful solution is available in css.
漂亮的解决方案在 css 中可用。
If u need space at start of paragraph the u can use
如果您需要在段落开头留出空间,您可以使用
p {text-indent: 10px; }
p {text-indent: 10px; }
If u need spacing between word use like this
如果你需要像这样使用单词之间的间距
non-breaking space: ' '
  em space: '?'
  en space: '?'
  thin space: '?'
see here for more options http://www.hypergurl.com/csstutorial7.html
在这里查看更多选项http://www.hypergurl.com/csstutorial7.html
You can give these style to html by inline, external and from in-page(<head>....</head>
)
你可以通过 inline、external 和 in-page( <head>....</head>
)将这些样式赋予 html
回答by Pekka
How about the letter-spacing
and/or word-spacing
CSS properties?
怎么样letter-spacing
和/或word-spacing
CSS属性?
回答by kgiannakakis
You should use margin or padding properties with your elements to adjust whitespace.
您应该对元素使用边距或填充属性来调整空白。
回答by James Drinkard
I used a span between two buttons.
我在两个按钮之间使用了一个跨度。
<span style="margin-left:70px;"></span>
<span style="margin-left:70px;"></span>
It spaced everything just where I needed it. I tried creating a "spacer" div, but that pushed one of the buttons below the other. I think that was because I was using a margin-bottom:30px; in the div.
它把所有东西都放在我需要的地方。我尝试创建一个“间隔”div,但这将一个按钮推到另一个下方。我认为那是因为我使用的是 margin-bottom:30px; 在 div 中。
回答by Pit J
You need to use:
您需要使用:
<p>I will display  </p>
<p>I will display  </p>
SIX-PER-EM SPACE
六个人的空间
<p>I will display  tt</p>
<p>I will display  tt</p>
EN QUAD space example
EN QUAD 空间示例
<p>I will display  tt</p>
<p>I will display  tt</p>
EM QUAD
EM QUAD
Char Dec Hex Entity Name
? 8192 2000 EN QUAD
? 8193 2001 EM QUAD
? 8194 2002   EN SPACE
? 8195 2003   EM SPACE
? 8196 2004 THREE-PER-EM SPACE
? 8197 2005 FOUR-PER-EM SPACE
? 8198 2006 SIX-PER-EM SPACE
? 8199 2007 FIGURE SPACE
? 8200 2008 PUNCTUATION SPACE
? 8201 2009   THIN SPACE
? 8202 200A HAIR SPACE
? 8203 200B ZERO WIDTH SPACE
Table
桌子
  ==
Basically you can replace 4 space with
基本上你可以用 4 个空格替换
##代码##