how I can change the size of font inside PHP


Tags: php,html,css

Problem :

I have this code but how I can put the picture in the center , how I can change the size of font and how I put it in the center. I knew how to do it by CSS if the HTML tags not inside the PHP tag but in this code the HTML tags inside PHP .

<html>
<head>
<title> page 1</title>
<body>
<?php
session_start();
$get_id= $_GET['id'];
$get_pass = $_GET['pass'];
$name = "";
$_SESSION['user_id']=$get_id;
$_SESSION['user_pass']=$get_pass;
$con = mysqli_connect('localhost', 'root', '');
if(!$con)
{
    die("not ok");
}

mysqli_select_db($con,"uoh");  
$q = " SELECT * FROM student WHERE id = " . $get_id ." and password = " . $get_pass;
$result = mysqli_query($con , $q ) ;
if($row = mysqli_fetch_array($result))
{
    if ($row["major"]=="computer engineerig")
    {
   echo "welcome ". $row["name"];
   echo " and your id is ".$row["id"];
   echo " and your major ".$row["major"];
   echo "<br />";
   echo '<a href="tran.php?page=A"><img src="tran.png"/></a>';
   echo '<a href="course_list.php?page=A"><img src="courselist.png"/></a>';
   echo '<a href="comp.php?page=A"><img src="comp.png"/></a>';
   }

   elseif ($row["major"]=="software engineerig")
   {
   echo "welcome ". $row["name"];
   echo " and your id is ".$row["id"];
   echo " and your major ".$row["major"];
   echo '<p>academic transcript <a href="tran.php?page=B">here</a></p>';
   echo '<p>courses list<a href="course_list.php?page=B">here</a></p>'; 
   echo '<p>student compliance <a href="comp.php?page=B">here</a></p>';
   }
   else
   echo "your ID not found";
}
?>
</body>
</html>


Solution :

There are several ways to do it. For simplicity, you can use the <style> tag.

To align the images:

echo '<p style="text-align:center"><a href="tran.php?page=A"><img src="tran.png"/></a></p>';

To reduce the font-size and center align the text:

echo '<p style="font-size:10px;text-align:center">academic transcript <a href="tran.php?page=B">here</a></p>';

    CSS Howto..

    How to achieve Expand collapse Side Nav with icon using jquery and boostrap css

    How to HTML/CSS Limit / Clip / Mask an object?

    How to tell the browser to ignore previous css edits?

    How to display table-cell on a single line (IE6-IE7)?

    show hidden div below current row of divs in responsive layout with jquery

    Test if is visible with ng-show attribute

    How to Fix Collapsing Top and Bottom Margins?

    How to apply effect just to background image and not text

    How to disable external css stylesheet - Newbie

    How can I change css for every DOM object in the page in SAPUI5

    how to horizontally center a div of 10000px (wider than full screen) in CSS?

    How CSS property “opacity” renders in browsers (IE, Chrome, Firefox, Opera)?

    Responsive portrait images, Hows & Dont's?

    How to apply css to iframe content? [closed]

    How to add a border bottom like the image?

    How to get just the responsive grid from Bootstrap 3?

    How do I iterate through array and set classes individually?

    How to create a scrollable Div Tag Vertically?

    How to add a class if div height reaches a fixed height?

    How do I make buttons that have the same transitions and some of the same properties, but then also have some differing properties?

    How to fill Frameless grid dynamically?

    How to target element inside iframe from css or javascript for styling

    How to select two different elements with an XPath query

    How to make empty div one line height using CSS?

    How can I apply an existing CSS class style to a dynamically created div?

    How to format HTML/CSS to align with single word in sentence?

    How to make mobile menu transition “backwards”?

    How to change default theme color teal to blue without using custom CSS in materilaize

    How to Center CSS Tabs

    How do you target div last-child within another div?