2016-12-20 3 views
-1

J'ai donc cette page: http://cmpt165.csil.sfu.ca/~jpadayat/exercise12/exercise12.htmlProblème avec le positionnement CSS

je dois la faire ressembler à ceci: https://courses.cs.sfu.ca/2016fa-cmpt-165-c0/pages/E12large/view

Je ne ai pas besoin de réduire la taille, le deuxième lien est uniquement référence à le positionnement.

J'ai essayé de faire le changement suivant dans mon CSS:

main { 
    float: right; 
} 

ou

nav { 
    float: left; 
} 

Voici mon HTML:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8" /> 
<meta name="viewport" content="width=device-width,initial-scale=1" /> 
<link rel="stylesheet" href="style.css" /> 
<title>Protocols</title> 
</head> 
<body> 

<h1 id="top">Protocols</h1> 

<nav> 
    <ul> 
    <li><a href="#top">Top of Page</a></li> 
    <li><a href="#email">Email</a></li> 
    <li><a href="#http">HTTP</a></li> 
    </ul> 
</nav> 


<main> 
<p><dfn>Protocols</dfn> (or <dfn>communications protocols</dfn>) are agreed ways for to computers to communicate and exchange information. The Wikipedia page on <a href="https://en.wikipedia.org/wiki/Communications_protocol">communications protocols</a> contains much more information than we can cover here.</p> 

<section id="email"> 
<h2>Email Protocols</h2> 
<p>There are several protocols that make email work:</p> 
<ul> 
<li><p><abbr title="Internet Message Access Protocol">IMAP</abbr> is used to fetch mail from the server so you can read it in clients like Thunderbird or on your phone.</p></li> 
<li><p><abbr title="Post Office Protocol">POP</abbr> is an older protocol that does the same job as IMAP, but is less flexible.</p></li> 
<li><p>The <abbr title="Simple Mail Transfer Protocol">SMTP</abbr> protocol is used to send email, either from a client program you are using, or from one mail server to another. SMTP has existed since the 1980s, but has been extended several times to add user authentication, encryption, and other features.</p> 
<p>SMTP is where most spam fighting happens: preventing fraudulent email from being sent the the ultimate goal.</p></li> 
</ul> 
</section> 

<section id="http"> 
<h2>HTTP</h2> 
<p>The <a href="https://en.wikipedia.org/wiki/World_Wide_Web">World Wide Web</a> rests on the protocol <abbr title="Hypertext Transfer Protocol">HTTP</abbr>.</p> 
<p>HTTP is a client-server protocol. That means that an HTTP client (like a web browser, also called a &ldquo;user agent&rdquo;) contacts an HTTP server and makes a request. The request is likely a request for a particular web page available on that server. The server will respond with a response: often the contents of the web page that was requested.</p> 
    <section id="uses"> 
    <h3>Uses</h3> 
    <p>HTTP is often used to transfer <abbr title="Hypertext Markup Language">HTML</abbr> documents which we generally think of as &ldquo;web pages&rdquo;. HTML contains markup like <code class="html">&lt;em&gt;</code> and <code class="html">&lt;a href="http://example.com/"&gt;</code>.</p> 
    <p>Every piece of content available on the web is called a <dfn>resource</dfn> and is available at a URL like <code class="url">http://example.com/somepage.html</code>.</p> 
    </section> 
</section> 

</main> 
</body> 
</html> 

Voici mon CSS:

nav ul { 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
} 
nav ul li { 
    margin: 0.2em; 
    padding: 0.75em 1em; 
    background: #689; 
    background-image: linear-gradient(to bottom, #689, #245); 
    border-radius: 1.25em; 
} 
nav a { 
    color: #fff; 
    text-decoration: none; 
    font-weight: bold; 
} 

main { 
    float: right; 
} 

rien ne semble fonctionner. aidez s'il vous plaît. Merci.

+1

S'il vous plaît ajouter du code significatif et une description du problème ici. Ne faites pas que lier le site qui a besoin de réparation - sinon, cette question perdra toute valeur pour les futurs visiteurs une fois le problème est résolu ou si le site que vous liez est inaccessible. Publier un [Exemple minimal, complet et vérifiable (MCVE)] (http://stackoverflow.com/help/mcve) indiquant que le problème vous aiderait à obtenir de meilleures réponses. Pour plus d'informations, voir [Quelque chose sur mon site web ne fonctionne pas. Puis-je simplement coller un lien?] (Http://meta.stackexchange.com/questions/125997/) –

+0

veuillez ajouter vos codes html et css –

+0

désolé à ce sujet. Je les ai ajoutés. –

Répondre

0

essayez avec ce

h1 { 
    text-align: center; 
} 
nav { 
    float: left; 
    padding-right: 30px; 
    width: 15%; 
} 
main { 
    float: left; 
    width: 40em; 
} 
+0

J'ai vérifié votre code source, vous avez commenté cette section –

+0

qui a fonctionné. Merci! –