Solved

Joomla v3 with Bootstrap v2 - How to Remove Right Margin

Posted on 2013-11-07
5
614 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SharePoint 2013 Searchbox Branding 11 44
Gradient CSS 4 30
Capture logon name 13 37
Target h5 of a div 3 7
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

26 Experts available now in Live!

Get 1:1 Help Now