Ir ao conteúdo
  • Cadastre-se

colocando um icone no menu html/css.


Posts recomendados

Olá galera, queria um ajuda no meu menu, queria colocar uma imagem dentro da parte "menu", ou seja, no centro.

Já tentei substituir com "background: url();"

Tenho que mexer no html?

Obs: É um menu com javascript.



/* Formatação do menu */

nav {
  display: block;
  position: fixed;
  width: 500px;
  height: 500px;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  -webkit-transform: translate3d(25px, -25px, 0);
          transform: translate3d(25px, -25px, 0);
  -webkit-transition: -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
  transition: -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9), -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
}
nav.open {
  -webkit-transform: translate3d(0, 0, 0);
          transform: translate3d(0, 0, 0);
}
nav.top-right {
  top: -160px;
  right: 0%;
}

.disc {
  position: absolute;
  display: inline-block;
  text-align: center;
  cursor: pointer;
  font: 25px Alegreya Sans, sans-serif;
  line-height: 40px;
  padding-top: 10px;
  border-radius: 250px;
  -webkit-transform: scale3d(0.5, 0.5, 0.5) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(0.5, 0.5, 0.5) rotate3d(0, 0, 1, 190deg);
  pointer-events: none;
  opacity: 0;
  cursor: pointer;
  -webkit-transition: opacity 0.5s, -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
  transition: opacity 0.5s, -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9), opacity 0.5s;
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9), opacity 0.5s, -webkit-transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 0.9);
}
.disc div {
  -webkit-transform: rotate(180deg);
          transform: rotate(180deg);
}
.open .disc {
  pointer-events: auto;
  opacity: 1;
}

.l1 {
  text-decoration: none;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  background: #8697cb;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l1 {
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
  -webkit-transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
  opacity: 1;
}
.open .l1:hover {
  background: #1a0a07;
  color: tomato;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l1:active {
  background: #803224;
  color: tomato;
}
.open .l1.toggle {
  -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
          transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
}

.l2 {
  text-decoration: none;
  top: 50px;
  left: 50px;
  right: 50px;
  bottom: 50px;
  background: #ff7a39;
  -webkit-transition-delay: 0.1s;
          transition-delay: 0.1s;
}
.open .l2 {
  -webkit-transition-delay: 0.1s;
          transition-delay: 0.1s;
  -webkit-transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
  opacity: 1;
}
.open .l2:hover {
  background: #1a0c06;
  color: #ff7a39;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l2:active {
  background: #803d1d;
  color: #ff7a39;
}
.open .l2.toggle {
  -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
          transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
}

.l3 {
  top: 100px;
  left: 100px;
  right: 100px;
  bottom: 100px;
  background: #ff912b;
  -webkit-transition-delay: 0.2s;
          transition-delay: 0.2s;
}
.open .l3 {
  -webkit-transition-delay: 0.2s;
          transition-delay: 0.2s;
  -webkit-transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
  opacity: 1;
}
.open .l3:hover {
  background: #1a0f04;
  color: #ff912b;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l3:active {
  background: #804916;
  color: #ff912b;
}
.open .l3.toggle {
  -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
          transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
}

.l4 {
  top: 150px;
  left: 150px;
  right: 150px;
  bottom: 150px;
  background: #ffa91c;
  -webkit-transition-delay: 0.3s;
          transition-delay: 0.3s;
}
.open .l4 {
  -webkit-transition-delay: 0.3s;
          transition-delay: 0.3s;
  -webkit-transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
  opacity: 1;
}
.open .l4:hover {
  background: #1a1103;
  color: #ffa91c;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l4:active {
  background: #80550e;
  color: #ffa91c;
}
.open .l4.toggle {
  -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
          transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
}

.l5 {
  top: 200px;
  left: 200px;
  right: 200px;
  bottom: 200px;
  background: #ffc00e;
  -webkit-transition-delay: 0.4s;
          transition-delay: 0.4s;
}
.open .l5 {
  -webkit-transition-delay: 0.4s;
          transition-delay: 0.4s;
  -webkit-transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
          transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, 190deg);
  opacity: 1;
}
.open .l5:hover {
  background: #1a1301;
  color: #ffc00e;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .l5:active {
  background: #806007;
  color: #ffc00e;
}
.open .l5.toggle {
  -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
          transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, 10deg);
}

.toggle {
  line-height: 100px;
  padding: 0;
  width: 100px;
  background: gold;
  opacity: 1;
  -webkit-transform: none;
          transform: none;
  pointer-events: auto;
  -webkit-transition-delay: 0s;
          transition-delay: 0s;
}
.open .toggle {
  -webkit-transform: rotate3d(0, 0, 1, 0deg);
          transform: rotate3d(0, 0, 1, 0deg);
}
.toggle:hover {
  background: #1a1600;
  color: gold;
}
.toggle:active {
  background: #806c00;
  color: rgba(255, 215, 0, 0.5);
  -webkit-transform: scale(0.9);
          transform: scale(0.9);
  -webkit-transition-duration: 0s;
          transition-duration: 0s;
}

 

Link para o comentário
Compartilhar em outros sites

Aqui esta.

Andei pesquisando um pouco, sei que tem que mexer no codigo do javascript, só que não tenho muito tempo para estudar a linguagem javascript, e preciso colocar o site logo no ar.

Obrigado pela ajuda. ^^

obs: se quiser coloco o código javascript aqui.

 

<!DOCTYPE html>
<html lang="pt-br">

<head>
	<meta charset="utf-8">
	<title></title>
	<link href="https://fonts.googleapis.com/css?family=Audiowide|Indie+Flower|Patrick+Hand|Permanent+Marker" rel="stylesheet">  
 	<link rel="stylesheet" type="text/css" href="_css/style.css">
</head>

<body id="corpo">

<div id="interface">	
	<header id="cabecalho">
		<img id="icone" src="_imagens/space-station.png">
		<h1 class="titulo"></h1>
		<h2 class="subtitulo"></h2>
		
	<nav class="top-right open">
		<<a href="index.html" class="disc l1">
			<div>home</div>
		</a>
		<a href="teoria/teoria.html" class="disc l2">
			<div>Teorias</div>
		</a>
		<a class="disc l3">
			<div>Sobre</div>
		</a>
		<a href="documentos/documentos.html" class="disc l4">
			<div>Documentos</div>
		</a>
		<a class="disc l5 toggle"><img src="_imagens/moon.png">
			Menu
		</a>
	<script src="_java/index.js"></script>

	</nav>
	</header>
</div>
<div id="materia">

</div>	
</body>
</html>

 

Link para o comentário
Compartilhar em outros sites

Boa noite, se entendi o que você quer fazer, faz o seguinte:

<img src="_imagens/moon.png" id="image">

Atribua um id para sua imagem, no caso acima id="image"

Agora no css faça o seguinte:

#image {
    width:100px;
    height:100px;
    position:absolute;
    top:50%;
    left:50%;
    margin-top:-50px;
    margin-left:-50px;
}

Você irá definir ao objeto duas margens negativas… a margem do topo (margin-top) e a margem da esquerda (margin-left). Na margem do topo, você simplesmente colocará um valor negativo, este valor será a metade da altura do objeto, neste caso, será -50px (margin-top:-50px;) e no lado esquerdo você fará a mesma coisa, mas o valor será a metade da largura do objeto, neste caso -50px (margin-left:-50px;).

Bom acho que é isso que você quer fazer, mais qualquer coisa é so chamar.

Link para o comentário
Compartilhar em outros sites

Deu certo, até uma parte kkkkk

Entra a imagem no index.html, aparece a lua, mas quando eu clico e abri o menu ela some.

Tô tentando aqui outras maneiras.

vou mandar meu código javascript. :)

toggle = document.querySelectorAll(".toggle")[0];
nav = document.querySelectorAll("nav")[0];
toggle_open_text = 'Menu';
toggle_close_text = 'Close';

toggle.addEventListener('click', function() {
	nav.classList.toggle('open');
	
  if (nav.classList.contains('open')) {
    toggle.innerHTML = toggle_close_text;
  } else {
    toggle.innerHTML = toggle_open_text;
  }
}, false);

setTimeout(function(){
	nav.classList.toggle('open');	
}, 800);

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!