简体   繁体   English

如何给我完整的身高元素?CSS

[英]How can I give my full height element?CSS

I have this site: 我有这个网站:

http://avocat2.dac-proiect.ro/?page_id=21 http://avocat2.dac-proiect.ro/?page_id=21

We made some changes in code with firebug and got these items (still changes are not made on site) 我们使用Firebug对代码进行了一些更改,并得到了这些内容(现场仍未进行更改)

Following changes looks like my site elements 进行更改后,看起来就像我的网站元素

This is code HTML: 这是代码HTML:

     <div class="container-fluid" style="">
          <div class="entry-content2">
               <div class="gigi">
                    <div class="row">
                    <div class="col-sm-12  col-md-12  col-lg-12  style=" "="">
                         <img src="wp-content/themes/WordPressBootstrap-master/images/LOGOb.png" class="img-responsive center-block" style="min-width:156px;min-height:83px">
                    </div>
               </div>
          </div>
          <div class="container-fluid">
               <p class="text-center" style="color:white;font-size:17px;padding-left:50px;padding-right:50px;padding-top:20px;padding-bottom:20px;">
                    Am reprezentat şi am acordat consultanţă juridică pentru clienţi persoane fizice române şi străine, instituţii publice, persoane juridice române şi străine în următoarele domenii:
               </p>
               <div class="row sss">
                    <div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-2" style="font-size:17px;color:white;">
                         <p class="text-left">
                              Drept civil<br>
                              – agricultură, exploatări agricole, prelucrarea şi comercializarea produselor agricole;<br>
                              – comerţ cu produse alimentare;<br>
                              – imobiliar;<br>
                              – distribuţie de carburanţi;<br>
                              – transporturi;<br>
                              – asigurări;<br>
                              – producţie şi comercializare utilaje grele;<br>
                              – producţie structuri metalice;<br>
                              – design, fotografie, artă;
                         </p>
                         <p></p>
                    </div>
                    <div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-0" style="font-size:17px;color:white;">
                         <p class="text-left">
                              Drept administrativ<br>
                              – producţie automatizări;<br>
                              – servicii de proiectare;<br>
                              – comercializare automatizări;<br>
                              – jocuri de noroc;<br>
                              – turism, hoteluri şi pensiuni;<br>
                              – medical;<br>
                              – construcţii civile şi industriale;<br>
                              – comercializare utilaje şi autovehicule, service auto;<br>
                              – producţie software, administrarea site-urilor;
                         </p>
                          <p></p>
                    </div>
                    <div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-0" style="font-size:17px;color:white;">
                         <p class="text-left">
                              – comerţ;<br>
                              – bursier, societăţi listate, investitori, fonduri de investiţii;<br>
                              – asistenţă şi îngrijire copii şi vârstnici;<br>
                              – exploatări forestiere şi prelucrarea lemnului;<br>
                              – extracţia şi prelucrarea minereurilor;<br>
                              – producţia şi comercializarea materialelor de construcţii;<br>
                              – instituţii publice;<br>
                              – instituţii religioase.
                         </p>
                         <p></p>
                    </div>
                    <p></p>
               </div>
          </div>
     </div><!-- .entry-content -->
</div>

I put a picture to understand better what I want to do 我放一张照片以更好地了解我想做什么

http://i57.tinypic.com/15nuftd.jpg

I searched and I found here a method that can give 100% height of an element 我搜索了一下,发现在这里可以给出100%高度的元素的方法

Make div 100% height of browser window 使div的浏览器窗口高度为100%

Unfortunately we applied 100vh code below and do not look at all well. 不幸的是,我们在下面应用了100vh代码,但效果并不理想。

.entry-content2
{
    background:url("http://avocat2.dac-proiect.ro/wp-content/themes/WordPressBootstrap-master/images/BODY-DROP.png");
    width:100%;
    height:100vh; // Here I applied this change      
}

I can not tell if I have correctly applied this amendment, the item to be. 我不能确定我是否正确地应用了该修正案。

Can you please help me solve this problem? 您能帮我解决这个问题吗? Thanks in advance! 提前致谢!

I suspect you want to move the entire <header id="masthead" class="navbar navbar-default" role="banner" style="background: transparent;"> element to the top of the website. 我怀疑您要将整个<header id="masthead" class="navbar navbar-default" role="banner" style="background: transparent;">元素移到网站顶部。 Right now that element is styled as 现在,该元素的样式为

.navbar-default {
  background-color: #f8f8f8;
  position: fixed;
  bottom: 12px;
  width: 100%;
}

That instruction says to place the entire header element (the purple box) at the bottom of the screen fixed, so its always there when users are scrolling. 该指令说将整个标题元素(紫色框)放置在固定的屏幕底部,因此当用户滚动时,它始终位于该位置。 Is that what you intended? 那是你想要的吗? For a large element, that you want to show users, then let them scroll down to view the rest of the home page, you might be better off with position: relative. 对于想要显示给用户的大元素,然后让他们向下滚动以查看主页的其余部分,最好使用position:relative。 At this point, without home page content, the site doesn't scroll at all, there isn't any content there. 在这一点上,没有主页内容,该站点根本不会滚动,那里没有任何内容。

Again, in simple words, exactly what are you trying to achieve? 再次,用简单的话来说,您到底想实现什么?

Update: I think you want to move the logo element 更新:我认为您想移动徽标元素

<div class="col-sm-12  col-md-12  col-lg-12  style=" "="">
       <img src="wp-content/themes/WordPressBootstrap-master/images/LOGOb.png" class="img-responsive center-block" style="min-width:156px;min-height:83px">
    </div>

from its current location to be inside of and at the top of the <header> element. 从其当前位置到<header>元素的内部和顶部。

Easy to do. 容易做。 Is this site static html, or generated from a .php sheet somewhere? 该网站是静态html,还是从某个地方的.php表生成? Is this a WordPress site? 这是一个WordPress网站? You have to just move the code in your html sheet. 您只需要在html表中移动代码即可。 If this is WordPress (or someother Content Management System) its a bit more difficult. 如果这是WordPress(或其他内容管理系统),则要困难一些。 You have to do it in the .php code. 您必须在.php代码中执行此操作。

Oops. 哎呀。 This is a wordpress theme. 这是一个WordPress主题。 Two strong suggestions. 两个强烈的建议。

1) Learn how to do a child theme. 1)学习如何做一个儿童主题。 It takes only 15 minutes to learn, and will save you hours and hours of work later. 它仅需15分钟即可学习,并且可以节省您数小时的工作时间。 Think of this a magic tissue paper you lay on an existing / purchased theme. 认为这是放置在现有/已购买主题上的魔术纸巾。 All your work goes on the tissue paper. 您的所有工作都在薄纸上进行。 When the theme updates, you don't lose any of your work. 主题更新时,您不会丢失任何工作。

2) Learn how to use the 3D View Tool in Firefox This will show you that the logo element is not in the same "box" as the rest of the purple header. 2)了解如何在Firefox中使用3D视图工具。这将向您显示徽标元素与紫色标题的其余部分不在同一“框”中。 To get there, right click on the screen in firefox. 要到达那里,请在firefox屏幕上右键单击。 Click on Inspect Element. 单击检查元素。 That will get you into Mozilla Developer tools. 这将带您进入Mozilla Developer工具。 then check the little gear icon on the right hand side of the developer tool bar. 然后检查开发者工具栏右侧的小齿轮图标。 Select [] 3D View. 选择[] 3D视图。 This places a 3D box icon on the developer tool bar. 这将在开发人员工具栏上放置一个3D框图标。 Now you can easily see that this site has LOTS of nested DIVS, some of which don't make much sense. 现在您可以轻松地看到该站点具有很多嵌套的DIVS,其中有些没有多大意义。 It's your home page template, you can make it as simple as you need. 这是您的主页模板,您可以根据需要使其变得简单。

3) Wordpress is one of the best documented tools on the planet. 3)Wordpress是地球上记录最好的工具之一。 Find a simple tutorial and start there (AFTER YOU CREATE A CHILD THEME). 找到一个简单的教程,然后从那里开始(在创建孩子主题之后)。

good luck with it. 祝你好运。

When i take your code and place it in my JSFiddle, then i get it to run. 当我拿起您的代码并将其放在我的JSFiddle中时,便可以运行它。 I took you CSS, the only thing i added was color: #ffffff; 我带了CSS,我唯一添加的就是color: #ffffff; so i could read the text. 这样我就可以阅读文字了。

.entry-content2
{
    background-image:url("http://avocat2.dac-proiect.ro/wp-content/themes/WordPressBootstrap-master/images/BODY-DROP.png");
    color: #ffffff; // just added color
    width:100%;
    height:100vh; 
}

You can see the result of the fiddle here which creates a fullscreen div in height as well. 您可以在此处看到小提琴的结果,该小提琴的结果也将创建一个全屏div高度。

So if this fiddle does not work for you, then i suspect it must be some browser problem? 因此,如果此小提琴对您不起作用,那么我怀疑它一定是某些浏览器问题? or something with the tags before the .entry-content2 div. 或.entry-content2 div之前带有标签的内容。 Could you place your full css and html code in the fiddle and test. 您能否将完整的CSS和HTML代码放在小提琴中并进行测试。

You can play around with the fiddle 你可以玩小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM