0

I'm iterating through the results of query and displaying select fields of each record. I want the text centered on screen. Using the CSS in the example looks OK on a regular computer screen but is too small on a Smart Phone. Of course I've greatly simplified the example to keep it short. The Question: How can I just get the text for each record to center... without only using 505 of the available screen width?

.center {
  margin: auto;
  width: 50%;
  border: 2px solid #d3d3d3;
  padding: 10px;
}

`enter code here`Query Results:<br>
<div class="center">
<a href="jsfiddle.net">Online Code Test</a></a><br>
``Is a site for testing some code online.<br>
But not PHP.<br>
Where can you test PHP online?<br>
</div>
<div class="center">
<a href="stackoverflow.com">Programmers Resource.</a></a><br>
The forum is very big.<br>
Members world wide.<br>
The go to place if you get stuck.<br>
</div>
Fran_3
  • 378
  • 1
  • 3
  • 12
  • 1
    `text-align: center`? – takendarkk Apr 08 '20 at 12:10
  • Does this answer your question? [How to make text vertically and horizontally center in an HTML page](https://stackoverflow.com/questions/9825796/how-to-make-text-vertically-and-horizontally-center-in-an-html-page) – Awais Apr 08 '20 at 12:36
  • Asking question differently To display 4 strings $str1,$str2, $str3, $str4 Each on a different line, left justified but displayed in the center of a normal monitor, not jammed over to the left side This works: .center { margin: auto; width: 50%; } BUT only uses 50% of the screen width. Looks OK on a monitor but 50% of a smart phone screen is to small. So how to 1)left justify lines 2)center in monitor screen 3) Use all or most of Smart Phone Screen Goal: Write code that displays well on both a computer monitor & on small screen devices – Fran_3 Apr 08 '20 at 14:20

0 Answers0