2017-02-06 7 views
1

基本的には、メニューバーを上にしてメインコンテナを75%〜25の割合で2つのセクションに分けて作成しようとしていますその上に、このコンテナの背景が無限に水平に伸びる必要があります。残念ながら、私は多少ので、これはここに私の現在のコードサブセクション内にサブセクションを持つコンテナを作成するにはどうすればいいですか?

@font-face { font-family: UbuntuG; src: url('ubuntu-fonts/Ubuntu-L.ttf'); } 
 
body { background-color: #2d2d2d; } 
 
h1 { 
 
    color: white; font-family: UbuntuG; font-size: 30; 
 
} 
 
h2 { 
 
    color: white; font-family: UbuntuG; font-size: 18; 
 
} 
 
p { 
 
    color: white; font-family: Arial; font-size: 16; 
 
} 
 
table, th, td { 
 
    border: 1px solid #1d1d1d; border-spacing: 0; color: white; font-family: Arial; font-size: 16; 
 
} 
 
td { 
 
    text-align: center; 
 
    padding: 0; 
 
    height: 48px; 
 
    min-width:48px; 
 
} 
 
a { 
 
     display: block; 
 
     text-decoration: none; 
 
\t color: white; 
 
\t font-family: UbuntuG; 
 
\t font-size: 16; 
 
     height:43px; 
 
     line-height:43px; 
 
} 
 

 

 
ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow: hidden; 
 
    background-color: #1d1d1d; 
 
} 
 

 
li { 
 
    float: left; border-right: 2px solid white; 
 
} 
 

 
li a { 
 
    display: block; 
 
    color: white; 
 
    text-align: center; 
 
    padding: 14px 16px; 
 
    text-decoration: none; 
 
} 
 

 
/* Change the link color to #111 (black) on hover */ 
 
li a:hover { 
 
    background-color: #111; 
 
} 
 
.active { 
 
    background-color: #00BFFF; 
 
} 
 

 
.left, 
 
.right { 
 
    float: right; 
 
    width: 46%; 
 
    padding: 2%; 
 
} 
 
.selector { 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    background-color: white; 
 
}
<html> 
 
    <head> 
 
    <title>Radio</title> 
 
    <meta content="??"> 
 
    <link rel="stylesheet" type="text/css" href="theme.css"> 
 
    <style> 
 
     table, th, td { border: 5px solid white; border-spacing: 0; color: #1d1d1d; font-family: Arial; font-size: 16; } 
 
     h1 { color: white; font-family: UbuntuG; font-size: 30; } 
 
    </style> 
 
    </head> 
 
    <body> 
 
    
 
    <div style="margin-top:-8;margin-right:-8;margin-left:-8"><ul> 
 
\t \t <li><a class="active" href="#home">Home</a></li> 
 
\t \t <li><a href="#about">Who are we?</a></li> 
 
\t \t <li><a href="#contact">Contact</a></li> 
 
\t </ul></div> 
 
    <div style="background-color: black"> 
 
\t \t <div class="right" align="right"> 
 
\t \t \t <img height=300px width=300px style="border:0px solid white;" src="https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.apple.com%2Fdownloads%2Fdashboard%2Fstatus%2Fimages%2Fpolarclockwidget_20070723105852.jpg&f=1"> 
 
\t \t \t <img height=300px width=300px style="border:0px solid white;" src="https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fa5.mzstatic.com%2Fus%2Fr30%2FPurple4%2Fv4%2Fae%2F41%2F4d%2Fae414d52-c726-ac67-27ea-02b8b56fcb37%2Ficon.png&f=1"> 
 
\t \t </div> 
 
\t \t 
 
\t \t <span class="left" align="left"> 
 
\t \t \t <p>PLAY NOW WIDGET</p> 
 
\t \t </span> 
 
    </div> 
 
    </body> 
 
</html>

+0

いただきまし通報しますか?あなたはその75%/ 25%をどこで設定しましたか?それは水平に分割されているか垂直になっているか?あなたのスニペットにbkgが表示されなかったので、背景はどこにありますか? –

+0

より具体的になるようにあなたの目標を言い換える必要があるかもしれません。たとえば、「無限に水平に」ということはどういう意味ですか?要素を任意の画面サイズに合わせたいのですか、画面に収まるアイテムがあればスクロールできるスクロールバーが必要ですか?また、75%の分割されたものは、分割をどのようにしたいかを定義したいかもしれません。 –

答えて

0

で、この時点で失われています は、私はあなたの質問から理解しているかのソリューションです。 メインのトップ・メニューのdivは全幅100%で、コンテンツ・コンテナはwidetが75%、img divが25%、コンテナの固定幅は1200px(例の幅)です。下のコードを参照してください。

@font-face { font-family: UbuntuG; src: url('ubuntu-fonts/Ubuntu-L.ttf'); } 
 
*{ box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;} 
 
body { background-color: #2d2d2d; } 
 
h1 { 
 
    color: white; font-family: UbuntuG; font-size: 30; 
 
} 
 
h2 { 
 
    color: white; font-family: UbuntuG; font-size: 18; 
 
} 
 
p { 
 
    color: white; font-family: Arial; font-size: 16; 
 
} 
 
table, th, td { 
 
    border: 1px solid #1d1d1d; border-spacing: 0; color: white; font-family: Arial; font-size: 16; 
 
} 
 
td { 
 
    text-align: center; 
 
    padding: 0; 
 
    height: 48px; 
 
    min-width:48px; 
 
} 
 
a { 
 
     display: block; 
 
     text-decoration: none; 
 
\t color: white; 
 
\t font-family: UbuntuG; 
 
\t font-size: 16; 
 
     
 
} 
 

 

 
ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow: hidden; 
 
    background-color: #1d1d1d; 
 
} 
 

 
li { 
 
    float: left; border-right: 2px solid white; 
 
} 
 

 
li a { 
 
    display: block; 
 
    color: white; 
 
    text-align: center; 
 
    padding: 14px 16px; 
 
    text-decoration: none; 
 
} 
 

 
/* Change the link color to #111 (black) on hover */ 
 
li a:hover { 
 
    background-color: #111; 
 
} 
 
.active { 
 
    background-color: #00BFFF; 
 
} 
 

 

 
.selector { 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    background-color: white; 
 
} 
 
/*Top full width container*/ 
 
.FullWidthContainer{ width:100%} 
 
/*Content Container With max-width:1200px for example*/ 
 
.MainContainer{max-width:1200px; width:100%; margin: 0px auto; } 
 
/* content containre divided in left-75% and right-25%}*/ 
 
.left{ width:75%; padding:2%; float:left;} 
 
.right{ width:25%; padding:2%; float:right} 
 
.right img{ width:100%}
<html> 
 
    <head> 
 
    <title>Radio</title> 
 
    <meta content="??"> 
 
    <link rel="stylesheet" type="text/css" href="theme.css"> 
 
    <style> 
 
     table, th, td { border: 5px solid white; border-spacing: 0; color: #1d1d1d; font-family: Arial; font-size: 16; } 
 
     h1 { color: white; font-family: UbuntuG; font-size: 30; } 
 
    </style> 
 
    </head> 
 
    <body> 
 
    
 
    <div class="FullWidthContainer"><ul> 
 
\t \t <li><a class="active" href="#home">Home</a></li> 
 
\t \t <li><a href="#about">Who are we?</a></li> 
 
\t \t <li><a href="#contact">Contact</a></li> 
 
\t </ul></div> 
 
    <div style="background-color: black" class="FullWidthContainer"> 
 
     <div class="MainContainer"> 
 
      <span class="left" align="left"> 
 
\t \t \t <p>PLAY NOW WIDGET</p> 
 
\t \t </span> 
 
\t \t <div class="right" align="right"> 
 
\t \t \t <img height=300px width=300px style="border:0px solid white;" src="https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.apple.com%2Fdownloads%2Fdashboard%2Fstatus%2Fimages%2Fpolarclockwidget_20070723105852.jpg&f=1"> 
 
\t \t \t <img height=300px width=300px style="border:0px solid white;" src="https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fa5.mzstatic.com%2Fus%2Fr30%2FPurple4%2Fv4%2Fae%2F41%2F4d%2Fae414d52-c726-ac67-27ea-02b8b56fcb37%2Ficon.png&f=1"> 
 
\t \t </div> 
 
\t \t 
 
\t \t 
 
     </div> 
 
    </div> 
 
    </body> 
 
</html>

+0

非常にありがとうございますが、ちょっと混乱したように見えるメニューバーには1つの問題があります。 – Apocolyptic

+0

私は上記のコードを修正しました。あなたは大歓迎です。感謝:) –

+0

もちろん、それほど多くのあなたが投票されているが、私は低い評判を得て、それが表示されるかどうかは分かりません。 – Apocolyptic

関連する問題