17. maj 2004 - 11:05
Der er
3 kommentarer og 1 løsning
Hvordan kan man gøre css bokse's størrelse afhængig af hinanden
Jeg har lavet et layout hvor jeg har tre bokse op siden. Til venstre har jeg navigationsboksen. I midten har jeg indholdsboksen og til venstre en ekstra boks til afsteminger osv. Inholdsboksen vokser alt efter hvor meget der står i den. Jeg vil gerne have at de to andre bokse følger med i størrelse, hvis dette kan lade sig gøre? Er der nogen der har prøvet dette før?. Kristian
Annonceindlæg tema
Forsvar & beredskab
Cybersikkerhed, realtidsdata og robuste it-systemer er blevet fundamentet for moderne forsvar.
Hej Kan du ikke lige smække lidt kode ind, så vi lige kan se hvordan du har opbygget din html skabelon. Der er nemlig flere måder at lave det på, alt efter hvordan man har opbygget sin side.
Hej saucer! Her er stylen og html'et. * html .leftboxhead h2 {height:1%;} .centerboxhead h2 {height:1%} .rightboxhead h2 {height:1%} #top { margin-top:10px; margin-left:5px; margin-right: 5px; padding:5px 0px 2px 0px; text-align:left; } #centertop{ margin-left:5px; margin-right:5px; margin-top:0px; margin-bottom:2px; background-color:transparent; padding:0; } p.forever { position:absolute; margin-top:0px; margin-left:75px; color:red; font-style:verdana; font-weight:bold; font-size:25px; } p.rest { position:absolute; margin-top:25px; padding:0; margin-left:35px; color:red; font-style:verdana; font-weight:bold; font-size:25px; } #menu { margin-left:5px; margin-right: 5px; margin-bottom:10px; height:18px; background-color:black; } #floatmenu { float:right; } ul.first { font-size:90%; margin-left:20px; padding:0; list-style:none; margin-bottom:0; } ul.first li { display:inline; } ul.first li a { margin:0; padding:5px 20px 5px 20px; border-width:1px 1px 1px 0; border-style:solid; border-color:#fff; color:#fff; background:black; line-height:2.0em; text-decoration:none; font-family: Verdana, Arial, Helvetica; font-size: 10px; } ul.first li a:hover { color:#FFCC00; } .leftcontent { position:absolute; left:5px; width:170px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .leftboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .leftboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: white; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .leftboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } .rightcontent { position:absolute; right:5px; width:170px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .rightboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .rightboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: transparent; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .rightboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } .centercontent { margin-left: 180px; margin-right:180px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .centerboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .centerboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: transparent; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .centerboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } <html> <head> <title>Tigra Menu GOLD</title> <link rel="stylesheet" href="style.css"> </head> <Body> <div id="top"> <div id="centertop"> <img src="img/Forever-Fitness_03.gif"> <p class="forever"> Forever </p> <p class="rest"> et livstilscenter </p> </div> </div> <div id="menu"> <div id="floatmenu"> <ul class="first"> <li><a href="java script:void(null)">Information</a></li ><li><a href="java script:void(null)">tidsbestilling</a></li ><li><a href="java script:void(null)">Kontakt</a></li > </ul> </div> </div> <div class="leftcontent"> <div class="leftboxhead"><h2></h2></div> <div class="leftboxbody"> left boks test </div> </div> <div class="rightcontent"> <div class="rightboxhead"><h2></h2></div> <div class="rightboxbody"> right boks test </div> </div> <div class="centercontent"> <div class="centerboxhead"><h2></h2></div> <div class="centerboxbody"> inholdstest<br> indholdstest </div> </div> </Body> </html>
Jeg har lige fjernet det unødvendige for at gøre det mere overskueligt. Her er stylen og html'et. * html .leftboxhead h2 {height:1%;} .centerboxhead h2 {height:1%} .rightboxhead h2 {height:1%} .leftcontent { position:absolute; left:5px; width:170px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .leftboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .leftboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: white; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .leftboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } .rightcontent { position:absolute; right:5px; width:170px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .rightboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .rightboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: transparent; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .rightboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } .centercontent { margin-left: 180px; margin-right:180px; background: url(sbbody-r.gif) no-repeat bottom right; font-size: 100%; } .centerboxhead { background: url(sbhead-r.gif) no-repeat top right; margin: 0; padding: 0; text-align: center; } .centerboxhead h2 { background: url(sbhead-l.gif) no-repeat top left; margin: 0; padding: 22px 30px 5px; color: transparent; font-weight: bold; font-size: 1.2em; line-height: 1em; text-shadow: rgba(0,0,0,.4) 0px 2px 5px; /* Safari-only, but cool */ } .centerboxbody { background: url(sbbody-l.gif) no-repeat bottom left; margin: 0; padding: 5px 30px 31px; } <html> <head> <title>Tigra Menu GOLD</title> <link rel="stylesheet" href="style.css"> </head> <Body> <div class="leftcontent"> <div class="leftboxhead"><h2></h2></div> <div class="leftboxbody"> left boks test </div> </div> <div class="rightcontent"> <div class="rightboxhead"><h2></h2></div> <div class="rightboxbody"> right boks test </div> </div> <div class="centercontent"> <div class="centerboxhead"><h2></h2></div> <div class="centerboxbody"> inholdstest<br> indholdstest </div> </div> </Body> </html>
02. november 2004 - 08:43
#4
lukket uden svar
Alle kurser indenfor Microsoft 365 – både til begyndere og øvede.