Solved

Joomla v3 with Bootstrap v2 - How to Remove Right Margin

Posted on 2013-11-07
5
607 Views
Last Modified: 2013-11-11
Hi Experts,

I can't seem to remove the right margin nor padding within the header tag which holds three sub-tags namely, header-1, header-2, header-3 even though i specified their values to be 0px as can been seen from the attached image.

Please help.

Thanks in advance,
Rick


Html Codes:

<?php
defined('_JEXEC') or die;

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

// Load optional RTL Bootstrap CSS
JHtml::_('bootstrap.loadCss', true);

?>

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width", initial-scal="1.0">
        <jdoc:include type="head" />
	
        <!--[if lt IE 9]>
		<script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
	<![endif]-->
        
        <!-- <title>Sample Tempalte</title>
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
        <link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
        <link href="css/bootstrap-extended.css" rel="stylesheet" type="text/css"> -->
        
        <!-- Custom Fonts -->
        <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
        
        <!-- Custom Styles -->
        <link href="templates/alpha1_0/css/custom.css" rel="stylesheet" type="text/css">
    </head>
    
    <body>
        <!-- Header Start -->
        <header class="row-fluid">
                
            <!-- Insert Logo Here -->
            <div id="header-1" class="span4">
                <jdoc:include type="modules" name="header-1" style="html5" />
            </div>

            <!-- Insert Slogan Here -->
            <div id="header-2" class="span4">
                <jdoc:include type="modules" name="header-2" style="html5" />
            </div>

            <!-- Insert Slogan Here -->
            <div id="header-3" class="span4">
                <jdoc:include type="modules" name="header-3" style="html5" />
            </div>
            
        </header>
        
    </body>
</html>

Open in new window


CSS Codes:

@charset "utf-8";
#header-1{
  background-color: red;
  margin-right: 0px;
  margin-left:  0px;
  border: 1px solid black;
}

#header-2{
  background-color: green;
  margin: 0px;
  padding:0px;
  border: 1px solid black;
}

#header-3{
  background-color: blue;
  margin: 0px;
  padding:0px;
  border: 1px solid red;
}

html {
  //width: auto !important;
  //overflow-x: hidden !important;
  border: 1px solid red;
  margin:0px;
  padding:0px;
}
body {  
  //width: auto !important;
  //overflow-x: hidden !important;
  border: 1px solid red;
  margin:0px;
  padding:0px;
  //background-color: yellow;
}

header {
  background:yellow;
  margin:0px;
  padding:0px;
}

Open in new window

website.jpg
0
Comment
Question by:RiCzN
  • 3
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39633496
Obviously, something else in the page is affecting the rendering post a link and we can do a diagnostic.

Cd&
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 39634855
First and foremost, use Firefox + Firebug to determine exactly how the style is being applied.  It looks like you have your custom style sheet loading after Bootstrap, which is how it should be.  But you're also applying the style to the upper level container elements.  The <jdoc> directive to include the modules is going to create additional elements within that container - elements that can (and probably are) targeted by bootstrap styles.

Use Firebug to determine exactly which element is being targeted by bootstrap.  Then you have the option of either targeting that element in your custom style, or in a worst-case scenario, creating a custom chrome, alternate layout, or core override to replace the HTML currently being generated.
0
 

Author Comment

by:RiCzN
ID: 39637952
Thank you for both or your replies. I'll will try using Firebug and will post back short.

Cheers
Rick
0
 

Author Comment

by:RiCzN
ID: 39640440
I found the element that was being targeted by bootstrap.

.row-fluid .span4 {
    width: 31.6239%;
}

The total is not 100% and therefore 5.1283% leftover is what we see on the right.

I made the adjustment to 33.33% and it fits nicely.

Thanks for your help
0
 

Author Comment

by:RiCzN
ID: 39640635
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now