简体   繁体   English

当我没有使文本具有正当效果时,为什么我的文本具有正当效果(css / php)

[英]Why does my text has the justify effect when I didnt made it to have this effect (css/php)

Why my text has the justify effect? 为什么我的文字有正当作用? In my whole site, I make echos and i dont specify a "text-align:justify;" 在我的整个站点中,我都做出了回应,并且未指定“ text-align:justify;”。 but my text is still justifying. 但我的文字仍然合理。 Justify is when you make the browser window smaller, the text moves so it fits in the window. 证明是当您缩小浏览器窗口时,文本会移动,使其适合窗口。 I tryed making something like this: <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } 我试图做这样的事情: <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } something <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } etc.... <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; }等。

but it just makes the text go in the center and it keeps the justify effect. 但这只会使文本居中,并保持对齐效果。

please help me =[ thanks 请帮助我= [谢谢

Justify is when you make the browser window smaller, the text moves so it fits in the window. 证明是当您缩小浏览器窗口时,文本会移动,使其适合窗口。

That's not what justify is. 那不是正当的理由。 Justify makes it so all lines of text are the same width, like this: Justify使文本的所有行都具有相同的宽度,如下所示:

替代文字
(source: pws-ltd.com ) (来源: pws-ltd.com

If you don't want the text to stay inside the window when you shrink it (so if you want a horizontal scrollbar), you have to set a min-width on a <div> containing the text. 如果不希望在缩小文本时将其保留在窗口内(因此,如果要水平滚动条),则必须在包含文本的<div>上设置min-width

Edit: though maybe I misunderstood what you were actually trying to do, and you just want it centered. 编辑:尽管也许我误解了您实际上要做什么,而您只是希望它居中。 If so, use margin: 0 auto; 如果是这样,请使用margin: 0 auto; not text-align: center; 不是text-align: center;

Justifying is when the spacing between the words is adjusted so text is fully aligned on both the left and the right of the block of text. 调整是指调整单词之间的间距以使文本在文本块的左侧右侧完全对齐。

What you are describing sounds like even though you want the text centered, it is long enough to fill the page and thus doesn't really look centered. 即使您要使文本居中,您所描述的声音听起来也很长,足以填满整个页面,因此看起来并不居中。 Consider adding something like this. 考虑添加这样的内容。 The fixed width keeps the text from filling the window, and the margin: 0 auto centers the h1 tag itself: 固定宽度可防止文本填充窗口, margin: 0 autoh1标签自身居中:

<style type="text/css">
    h1 { text-align: center; width: 300px; margin: 0 auto }
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM