Jump to content

Recommended Posts

Hi,

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.

 css:

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 {
width:350px;
height:280px;
  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 {
width:100%;
}


h3{
  font-size: 25px;
  font-weight: 640;
  margin-bottom: 10px;
  color: #e7e7e7;
  padding:6px;
  font-family:'sans-serif','helvetica';
}



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

}
input[type='password']{
	background: transparent url("img/pass.jpg") no-repeat;
	background-position: 10px 50%;
}
input[type='text']{
	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%;
  margin-top:10px;
}

.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;
}

php:
 

<?php 
include('dbcon.php');
include('session.php'); 

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

 ?>

<html>
<head>
<link rel="stylesheet" type="text/css" href="style2.css">
</head>
<body>
<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>
	</div>
</div>
</form>
</body>
</html>

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

Thanks

 

notaligned.png

Link to comment
https://forums.phpfreaks.com/topic/310279-css-with-php/
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
Link to comment
https://forums.phpfreaks.com/topic/310279-css-with-php/#findComment-1575387
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.