2017-04-25 24 views
-3

我需要三種形式在同一行,並希望他們左,中,右。我已經嘗試了很多次,請幫忙。如何將表格保存在同一行中?

<!DOCTYPE html> 
    <html> 
     <head> 
     <title>Conspiracy Theories</title> 
     <link href="p1.css" type="text/css" rel="stylesheet"> 
     </head> 
      <body> 
      <h1>World reacts to US strikes, with many expressing support</h1> 

     <div class="div1"> 
     <form action="WP8.html"><input type="submit" value="Prev." /></form> 
     <form action="web.html"><input type="submit" value="Home" /></form> 
     <form action="WP10.html"><input type="submit" value="Next" /></form> 
     </div> 

     <center><img src="http://www.darpa.mil/DDM_Gallery/gremlins-619-316-pp.jpg"></center> 

      ect... 
+1

'顯示:inline'上的表格。 –

+1

'

'元素已棄用,不應使用。[閱讀全文](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center) – happymacarts

+1

爲什麼使用表單?只需使用鏈接,它似乎可以實現你想要做的更好的語義和更少的HTML功能。 – TricksfortheWeb

回答

0

可以將這些按鈕的容器上使用display: flexjustify-content: space-between;。這將分配的按鈕跨過容器/頁面寬度相等:

.div1 { 
 
    display: flex; 
 
    justify-content: space-between; 
 
}
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <title>Conspiracy Theories</title> 
 
    <link href="p1.css" type="text/css" rel="stylesheet"> 
 
</head> 
 

 
<body> 
 
    <h1>World reacts to US strikes, with many expressing support</h1> 
 

 
    <div class="div1"> 
 
    <form action="WP8.html"><input type="submit" value="Prev." /></form> 
 
    <form action="web.html"><input type="submit" value="Home" /></form> 
 
    <form action="WP10.html"><input type="submit" value="Next" /></form> 
 
    </div> 
 

 
    <center><img src="http://www.darpa.mil/DDM_Gallery/gremlins-619-316-pp.jpg"></center>

相關問題