Jump to content
#StayAtHome ×

CSS with PHP

Recommended Posts


I have created buttons from php and html and have css for styling. the buttons come below each other as expected but they are not aligned to the same size.


body {
  color: #fff;
  font: 87.5%/1.5em 'Open Sans', sans-serif;
	background:url(img/bg.jpg)no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;}

.buttonstyle {
  background-color: #4CAF50; /* Green */
  border: none;
  color: white;
  padding: 15px 80px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
  margin: 5;

.form-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -184px 0px 0px -155px;
  background: rgba(0,0,0,0.27);
  padding: 25px 25px;
  border-radius: 5px;
  box-shadow: 0px 1px 0px rgba(0,0,0,0.6),inset 0px 1px 0px rgba(255,255,255,0.04);

.form-item {

  font-size: 25px;
  font-weight: 640;
  margin-bottom: 10px;
  color: #e7e7e7;

.form-item input{
  border: none;
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 1.2em;
  height: 49px;
  padding: 0 16px;
  width: 100%;
  padding-left: 55px;

	background: transparent url("img/pass.jpg") no-repeat;
	background-position: 10px 50%;
	background: transparent url("img/user.jpg") no-repeat;
	background-position: 10px 50%;


.form-item input:focus {
  outline: none;
  border:1.4px solid #cfecf0;

.button-panel {
  margin-bottom: 20px;
  padding-top: 10px;
  width: 100%;

.button-panel .button {
  background: #00b6df;
  border: none;
  color: #fff;
  cursor: pointer;
  height: 50px;
  font-family: 'helvetica','Open Sans', sans-serif;
  font-size: 1.2em;
  text-align: center;
  text-transform: uppercase;
  transition: background 0.6s linear;
  width: 100%;

.button:hover {
  background: #6eb7cb;

.form-item input, .button-panel .button {
  border-radius: 2px

.reminder {
  text-align: center;

.reminder a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s;

.reminder a:hover {
  color: #cab6bf;



$result=mysqli_query($con, "select * from admin_login where username='$session_id'")or die('Error In Session');


<link rel="stylesheet" type="text/css" href="style2.css">
<form action="test2.php" method="post">
<div class="form-wrapper"> 
    <center><h3>Welcome: <?php echo $row['Name']; ?> </h3></center>
	<button type="submit" name = "adminmanagement" class="buttonstyle">Manage Admin Info</button>
	<button type="submit" name = "staffmanagement" class="buttonstyle">Manage Staff Info</button>
	<button type="submit" name = "reportsmanagement" class="buttonstyle">Manage Reports</button>
	<div class="reminder">
    <p><a href="logout.php">Log out</a></p>

attached output, the buttons are not of same size...




Share this post

Link to post
Share on other sites

They aren't the same width because you don't have any sort of CSS in there that says anything about a width. It's not like the browser can read your mind about how you want it to appear...

Have you tried giving the buttons a width?

  • Like 1
  • Great Answer 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.