Abr 14

Na figura abaixo podemos ver a estrutura básica de um sítio:

Tutorial - Redimensionando height de Iframe com JavaScript - imagem 1

Div “Geral”, local aonde fica alocado conteúdo, rodapé, cabeçalho…

Div “Conteúdo”, conteúdo do site no nosso caso é aonde ficará o Iframe

Iframe a ser redimensionado.

O Iframe abrirá páginas com diferentes alturas (height). O tutorial tem como objetivo ensinar como redimensionar esse atributo.

1º Passo - Declaração do Iframe

<iframe name=”name_iframe” frameborder=”0″ src=”src_padrão” id=”id_iframe” scrolling=”no” width=”largura_iframe” height=”altura_inicial_iframe”></iframe>

2º Passo – Criar Div na página que abre dentro do Iframe:

<div id=”tamanho”>

Conteúdo

</div>


3º Passo – Inserir código JavaScript na página que abrirá dentro do Iframe:

<script language=”JavaScript” type=”text/javascript”> parent.document.getElementById(”id_do_iframe”).height = document.getElementById(”tamanho”).scrollHeight + 40;

</script>

Obs: Inserir Java Script depois do Div “Tamanho”


Esta função calcula a altura( height) do Div “Tamanho”, adicionando 40 pixels para margens e redimensiona a luta previamente definida no Iframe.

Espero que esse tutorial seja útil em situações do dia-a-dia.

Davi de Alencar
davi@portaltecnologia.net

 

 

Mar 10

Este sábado estava criando um menu de cascata utilizando JavaScript + CSS, em determinado momento senti a necessidade de alterar propriedades Css (background-color, border, color e etc.) via Javascript. Pesquisei encontrei essa excelente lista com as definições de Css X JavaScript, obra do grande Profº Hebert.

Segue a lista:

Propriedade - CSS Referência - JavaScript
background background
background-attachment backgroundAttachment
background-color backgroundColor
background-image backgroundImage
background-position backgroundPosition
background-repeat backgroundRepeat
border border
border-bottom borderBottom
border-bottom-color borderBottomColor
border-bottom-style borderBottomStyle
border-bottom-width borderBottomWidth
border-color borderColor
border-left borderLeft
border-left-color borderLeftColor
border-left-style borderLeftStyle
border-left-width borderLeftWidth
border-right borderRight
border-right-color borderRightColor
border-right-style borderRightStyle
border-right-width borderRightWidth
border-style borderStyle
border-top borderTop
border-top-color borderTopColor
border-top-style borderTopStyle
border-top-width borderTopWidth
border-width borderWidth
clear clear
clip clip
color color
cursor cursor
display display
filter filter
font font
font-family fontFamily
font-size fontSize
font-variant fontVariant
font-weight fontWeight
height height
left left
letter-spacing letterSpacing
line-height lineHeight
list-style listStyle
list-style-image listStyleImage
list-style-position listStylePosition
list-style-type listStyleType
margin margin
margin-bottom marginBottom
margin-left marginLeft
margin-right marginRight
margin-top marginTop
overflow overflow
padding padding
padding-bottom paddingBottom
padding-left paddingLeft
padding-right paddingRight
padding-top paddingTop
page-break-after pageBreakAfter
page-break-before pageBreakBefore
position position
float styleFloat
text-align textAlign
text-decoration textDecoration
text-decoration: blink textDecorationBlink
text-decoration: line-through textDecorationLineThrough
text-decoration: none textDecorationNone
text-decoration: overline textDecorationOverline
text-decoration: underline textDecorationUnderline
text-indent textIndent
text-transform textTransform
top top
vertical-align verticalAlign
visibility visibility
width width
z-index zIndex

Fonte: Clique aqui

Davi de Alencar Silva
davi@portaltecnologia.net

Tags: , , , , , , , ,

Fev 06

Olá caros leitores, como post inicial vim comentar sobre um assunto que já me perturbou muito, trata-se de CSS Reset.

Quantas vezes ao criar um Layout, ele magicamente inclui pixels ali e acolá. Se torna um verdadeiro calvário deixar o layout da maneira que realmente nos convém.

Isso acontece por que alguns elementos HTML possuem valores de margin, padding, bordas e outras formatações setados por padrão para que os sites sejam visualizados.

De uma maneira simplificada pode ser feito assim:

* {
margin:0;
padding:0;
list-style:none;
}

O seletor * funciona para selecionar todos os atributos, com ele temos uma maneira rápida e fácil de limparmos o CSS.

Segue exemplo de uma limpeza mais bruta: http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/.

É claro que isso depende de cada um, mas fica ai a dica.

Tags: ,